DropDown.vue
1.5 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
<template>
<van-dropdown-menu active-color="#3369B1" class="qw-drop-down">
<van-dropdown-item v-model="value1" :options="option1" @change="selectChange" />
<van-dropdown-item v-model="value2" :disabled="disabled" :options="option2" @change="selectSecondChange" />
</van-dropdown-menu>
</template>
<script>
export default {
name: 'DropDown',
data() {
return {
option1: this.selectOption1,
option2: this.selectOption2,
value1: this.currentValue1,
value2: this.currentValue2,
disabled: false
}
},
watch: {
currentValue1(n) {
this.value1 = n
},
currentValue2(n) {
this.value2 = n
},
selectOption2(n) {
this.option2 = n
}
},
props: {
selectOption1: {
type: Array,
default: () => {
return []
}
},
selectOption2: {
type: Array,
default: () => {
return []
}
},
currentValue1: {
type: Number,
default: 0
},
currentValue2: {
type: Number,
default: 0
}
},
methods: {
selectChange(value) {
this.disabled = false
if (value == 2) this.disabled = true
this.value1 = value
this.$emit('changeFirst', value)
},
selectSecondChange(value) {
this.value2 = value
this.$emit('changeSecond', value)
}
}
}
</script>
<style lang="scss" scoped>
.qw-drop-down /deep/ .van-dropdown-menu__title {
font-size: 14px !important;
font-weight: 400 !important;
color: #333333 !important;
}
</style>