cuiqian2004
2025-03-14 00814401bba75825126baa6675e542ea3c82a5bb
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
    <view class="oi-time-picker">
        <picker mode="time" :disabled="disabled" @change="onChange">
            <view class="oi-time-picker-x"
                :class="{'oi-time-picker-disabled': disabled,'oi-time-picker-border': border}">
                <uni-icons class="icon-calendar" type="calendar" color="#c0c4cc" size="22"></uni-icons>
                <view class="oi-time-picker-input">{{displayValue}}</view>
            </view>
        </picker>
    </view>
</template>
<script>
    import dayjs from "dayjs";
    export default {
        name: 'OITimePicker',
        props: {
            value: {
                type: String,
                default: ''
            },
            modelValue: {
                type: [String, Number],
                default: ''
            },
            placeholder: {
                type: String,
                default: ''
            },
            border: {
                type: [Boolean],
                default: true
            },
            disabled: {
                type: [Boolean],
                default: false
            },
            format: {
                type: String,
                default: ''
            },
 
        },
        data() {
            return {
                displayValue: "",
            }
        },
        methods: {
            onChange(e) {
                this.displayValue = e.detail.value
                console.log(this.displayValue, e.detail)
                this.$emit('update:modelValue', this.displayValue)
                this.$emit('input', this.displayValue)
                this.$emit("change", this.displayValue)
            },
 
        },
        mounted() {
 
        },
        watch: {
            // #ifndef VUE3
            value(val) {
                this.displayValue = val
            },
            // #endif
            // #ifdef VUE3
            modelValue(val) {
                this.displayValue = val
            },
            // #endif
 
        },
    }
</script>
 
<style lang="scss">
    .oi-time-picker {
 
        width: 100%;
        flex: 1;
 
        .oi-time-picker-x {
 
 
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            background-color: #fff;
            color: #666;
            font-size: 14px;
            flex: 1;
 
 
 
            .icon-calendar {
                padding-left: 3px;
            }
 
            .oi-time-picker-input {
                width: auto;
                height: 35px;
                /* #ifndef MP */
                padding-left: 5px;
                /* #endif */
                position: relative;
                flex: 1;
                line-height: 35px;
                font-size: 14px;
                overflow: hidden;
            }
 
        }
 
        .oi-time-picker-disabled {
            opacity: 0.4;
            cursor: default;
        }
 
        .oi-time-picker-border {
            box-sizing: border-box;
            border-radius: 4px;
            border: 1px solid #e5e5e5;
        }
    }
</style>