#
whycq
2023-12-01 f979ed5a82e2038b96ea7eb2063fcf08a6ba1bf8
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
<template>
    <view class="user-input">
        <uni-icons class="title-icon" :type="titleIcon" size="20" color="#707070" ></uni-icons>
        <view class="box-text">{{title}}:</view>
        <input class="input" type="text"  :placeholder="placeholder" v-model="data" v-show="inputType == 'text'">
        <input class="input" type="password"  :placeholder="placeholder" v-model="data" v-show="inputType == 'password'">
        <uni-icons class="opt-icon" :type="optIcon" size="20" color="#707070" v-show="optIconShow"></uni-icons>
        
        <!-- <uni-icons class="user-input-icon" :type="titleIcon" size="20" color="#707070" ></uni-icons>
        <view class="user-input-text">{{title}}:</view>
        <input class="user-input-input" :type="inputType"  :placeholder="placeholder" v-model="data">
        <uni-icons class="user-input-opticon" :type="optIcon" size="20" color="#707070" v-show="optIconShow"></uni-icons> -->
        <!-- <uni-icons class="user-input-icon" :type="titleIcon" size="20" color="#707070" ></uni-icons>
        <view class="user-input-text">{{title}}:</view>
        <input class="user-input-input" :type="inputType"  :placeholder="placeholder" v-model="data"> -->
    </view>
</template>
 
<script>
    export default{
        name: 'My-input',
        components: {
            
        },
        props: {
            titleIcon: {
                type: String,
                default: 'person'
            },
            title: {
                type: String,
                default: '账号'
            },
            placeholder: {
                type: String,
                default: ''
            },
            inputType: {
                type: String,
                default: 'text'
            },
            optIcon: {
                type: String,
                default: 'eye'
            },
            optIconShow: {
                type: Boolean,
                default: false
            },
            value: {
                type: [String,Number],
                default: ''
            },
        },
        watch: {
            data(val) {
                this.$emit('input',val)
            },
            value(val) {
                this.data = val
            },
        },
        data() {
            return {
                data:'',
            }
        }
        
    }
</script>
 
<style lang="scss" scoped>
    .user-input {
        width: 100%;
        height: 45px;
        display: flex;
        color: #606164;
        align-items: center;
        background-color:  #ECF0F1;
        border-radius: 7px;
        box-shadow: inset 4px 4px 4px rgba(0,0,0,.3),
                    inset -4px -4px 4px rgba(255,255,255,.7),
                    -4px -4px 5px rgba(0,0,0,.4);
    }
    
    .user-input-icon{
        
    }
    
    
    .title-icon {
        margin: 0 8px 0 8px;
    }
    .box-text {
        line-height: 1;
    }
    .input {
        flex:1;
        margin-left: 8px;
        margin-right:8px;
    }
    .opt-icon {
        margin-left: auto;
        margin-right: 8px;
    }
</style>