liangjin
2021-04-09 2cd8d830e88084219f081cb6822dabc146ff6054
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
 * @Author: 小明丶
 * @Date: 2020-01-15 09:50:23
 * @LastEditors  : 小明丶
 * @LastEditTime : 2020-01-15 16:51:51
 * @Description: 
 -->
<template>
    <div class="ipt-com">
        <p>
            <span>{{tit}}</span>
            <span v-if="mustFill">*</span>
        </p>
        <input v-model="newVal" class="input" :class="[readonly ? 'readonly' : '']" :type="type" :maxlength="max"  :disabled="readonly"  :placeholder="placeholder"  >
    </div>
</template>
<script>
export default {
    model: {
      prop: 'value',
      event: 'input'
    },
    props: {
            tit:String,
            mustFill:{
                type:Boolean,
                default:false
            },
            max:[String,Number],
            type:{
                type:String,
                default:'text'
            },
            // 左侧文字
            label:String,
            //左侧图标类名
            icon: String,
            //是否展示右侧图标
            isLink: {
                type: Boolean,
                default: false
            },
            // title文字加粗
            isTitle:{
                type: Boolean,
                default: false
            },
            // 是否只读
            readonly: {
                type: Boolean,
                default: false
            },
            // 是否禁用
            disabled:{
                type: Boolean,
                default: false
            },
            // input 的vmodel
            value:[String, Number],
            placeholder:String,
        },
    computed: { 
        newVal: {
            get:function() {
                return this.value; 
            },
            set:function(value) {
                  this.$emit('input', value);
            }
        },
    },
}
</script>
<style lang="less" scoped>
    .ipt-com{
        width: 100%;
        margin-bottom: 16px;
        p{
            margin-bottom: 10px;
            span:nth-of-type(1){
                font-size: 13px;
                color: #999999;
            }
            span:nth-of-type(2){
                font-size: 13px;
                color: #FF6666
            }
        }
        input::-webkit-input-placeholder{color:#333333;}
        input{
            background-color: #F9FAFF;
            width: 100%;
            height: 40px;
            border: 1px solid rgba(205,211,246,1);
            border-radius:4px;
            font-size: 14px;
            color: #333;
            padding-left: 8px;
            display: inline-block;
            box-sizing: border-box;
        }
        select{
            background-color: #CDD3F6;
            width: 100%;
            height: 40px;
            border: 1px solid rgba(205,211,246,1);
            border-radius:4px;
            font-size: 14px;
            color: #333;
        }
    }
</style>