PullDownSelect.vue
1.85 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
<template>
<div class="down-select">
<div class="type-plugin">
<div class="trend-type-box" @click.stop="switchType">
<div class="text">{{ selectType || selectList[0].name }}</div>
<div class="trangle-icon"></div>
</div>
<SelectBox
:isShow="isShow"
isObject
:defaultValue.sync="selectList[0]"
@clickOutside="clickOutside"
:dataList.sync="selectList"
:boxWidth="boxWidth"
@selectVal="selectVal"
:labelName="'name'"
:valueName="'name'"
></SelectBox>
</div>
</div>
</template>
<script>
export default {
name: 'PullDownSelect',
props: {
selectList: {
type: Array,
default: () => []
},
boxWidth: {
type: String,
default: '9.1vw'
}
},
data() {
return {
isShow: false,
selectType: ''
}
},
mounted() {},
methods: {
switchType() {
this.isShow = !this.isShow
},
clickOutside() {
this.isShow = false
},
selectVal(val) {
this.selectType = val.name
this.$emit('selectVal', val)
this.switchType()
}
}
}
</script>
<style lang="scss" scoped>
.down-select {
.type-plugin {
position: relative;
}
.trend-type-box {
display: flex;
width: fit-content;
height: 2.22vh;
line-height: 2.22vh;
padding: 0 0.83vw;
box-sizing: border-box;
background-image: linear-gradient(269deg, #5663ff00 10%, #6578ffd4 49%, #079ff1 100%);
.text {
font-weight: 500;
font-size: 14px;
color: #ffffff;
margin-right: 0.83vw;
}
.trangle-icon {
width: 0px;
height: 0px;
border: 4px solid transparent;
border-top: 4px solid #fff;
margin-top: 6%;
}
}
/deep/.select-box {
top: 2.8vh;
padding: 0.5vw 0;
.select-item {
padding: 0 0.5vw;
}
}
}
</style>