day-choose.vue
2.06 KB
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
<!--求购时限选择-->
<template>
<div class="customSelectWrapper" @click="showPicker">
<div class="customSelectTextWrapper" >
<span class="leftText">求购期限:</span>
<div class="rightWrapper">
<span class="rightText">{{currentOption || '7天'}}</span>
<i class="cubeic-arrow" ></i>
</div>
</div>
</div>
</template>
<script>
import {Select} from 'cube-ui';
export default {
name: 'DayChoose',
props: {
options: {
type: Array,
default: [],
},
chooseDay: {
type: String,
default: '7天',
},
choose: {
type: Function,
default: ()=>{},
}
},
components: {Select},
computed: {
currentOption: {
get() {
return this.current || this.chooseDay;
},
set(val) {
this.current = val;
}
}
},
data() {
return {
// value: '7天',
title: '选择求购时限',
current: '',
};
},
methods: {
change(value, index, text) {
// console.log('change', value, index, text);
this.choose && this.choose(value[0]);
this.current = value[0];
},
showPicker() {
console.log(this.options);
this.$createPicker({
title: '选择求购时限',
data: [this.options],
onSelect: this.change,
selectedIndex: [2],
onCancel: () => {
}
}).show();
}
}
};
</script>
<style lang="scss" scoped>
.customSelectWrapper {
position: relative;
height: 60px;
padding-top: 10px;
}
.customSelectTextWrapper {
position: absolute;
width: 100%;
height: 60px;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.leftText {
font-family: PingFang-SC-Regular;
font-size: 14*2px;
color: #000000;
letter-spacing: 0;
}
.rightWrapper {
}
.rightText {
font-family: PingFang-SC-Regular;
font-size: 14*2px;
color: #000000;
letter-spacing: 0;
}
.customSelect {
position: relative;
opacity: 1 !important;
z-index: 1;
}
</style>