<template>
<view>
<uni-datetime-picker v-model="values" @change="bindPickerChange" :hide-second="hideSecond">
<view class="aic dateLineheight">
<view class="uni-sel-input"
:class="!disabled&&values?'':'text-gray'"
>{{values?values:placeholder}}</view>
<uni-icons type="right" size="45rpx" color="#C0C4CC"></uni-icons>
</view>
</uni-datetime-picker>
</view>
</template>
<script>
export default {
name: "selectDate",
props: {
value: {
type: String,
default: ""
},
placeholder: {
type: String,
default: ""
},
placeholderStyle: {
type: String,
default: "text-align:right"
},
dictCode:{
type: String,
default: "ent_identity"
},
dataType:{
type: String,
default: "select"
},
hideSecond:{
type: String,
default: false
},
},
model: {
prop: 'value',
event: 'change',
},
watch:{
value:{
handler(val){
if(val){
this.values = val
}
},
immediate:true
},
},
data() {
return {
show: false,
values: "",
array: [],
index:0,
};
},
methods: {
bindPickerChange(data) {
// TODO 兼容 vue2
this.$emit('input', data.trim())
this.$emit('change', data.trim())
},
}
}
</script>
<style lang="scss">
</style>
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
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