query-item.vue
1.54 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
<template>
<view>
<view class="popup-alarm-text"><text class="text">{{leftText}}</text></view>
<view class="u-flex popup-alarm-child">
<view v-for="(item, index) in queryStatus" :key="index" class="alarm-text" @click="currentClick(item,index)"
:style="[index == currentIndex ? { hignLightColor } : { unHighlightColor }]">
<text :class="[index == currentIndex ? 'select-text' : 'un-select-text']"
class="text">{{ item.name }}</text>
</view>
</view>
<view style="height:180rpx"></view>
</view>
</template>
<script>
export default {
props: {
leftText: String,
queryStatus: Array
},
data() {
return {
currentIndex: 0,
}
},
computed: {
hignLightColor() {
return `background: 'rgba(55, 125, 255, 0.05)', border: '1rpx solid rgba(55, 125, 255, 0.3)'`
},
unHighlightColor() {
return `background: '#F6F6F6'`
}
},
methods: {
currentClick(item, index) {
this.currentIndex = index
this.$emit('currentClick', item, index)
},
reset() {
this.currentIndex = 0
}
}
}
</script>
<style lang="scss" scoped>
.popup-alarm-text {
width: 750rpx;
margin-left: 14rpx;
.text {
color: #333333;
font-size: 14px;
}
}
.popup-alarm-child {
margin-top: 15rpx;
width: 750rpx;
height: 60rpx;
flex-wrap: wrap;
margin-left: -10rpx;
.alarm-text {
margin: 25rpx;
line-height: 50rpx;
text-align: center;
width: 180rpx;
height: 60rpx;
background-color: #f6f6f6;
border-radius: 32px;
.text {
color: #333333;
font-size: 13px;
}
}
}
</style>