| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <div class="c-input">
- <label>
- <span>{{iconMap.upload}} 点击选取文件上传</span>
- <input
- type="file"
- :placeholder="placeholder"
- :value="value"
- @input="$emit('input', $event.target.value)"
- />
- </label>
- </div>
- </template>
- <script>
- import iconMap from '@/utils/icon-map'
- export default {
- model: {
- prop: 'value',
- event: 'input'
- },
- props: {
- value: String,
- placeholder: String
- },
- data () {
- return {
- iconMap: iconMap
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~@/style/theme.scss';
- .c-input {
- position: relative;
- display: inline-flex;
- align-items: center;
- overflow: hidden;
- box-sizing: border-box;
- font-size: 16px;
- font-weight: bold;
- color: #3a4a5a;
- background: $input-background-color;
- border-radius: 8px;
- border: none;
- outline: none;
- width: 100%;
- height: 48px;
- line-height: 40px;
- padding: 0 0 0 12px;
- transition: .2s;
- & span {
- font-family: 'iconfont', sans-serif;
- display: block;
- vertical-align: middle;
- color: #5a6a7a;
- }
- &:hover {
- background: darken($input-background-color, 5);
- }
- }
- input {
- position: absolute;
- left: 0;
- top: 0;
- padding: 20px 0;
- width: 100%;
- opacity: 0;
- }
- </style>
|