From 617e4ec527a240d2bc030e813c98652c1bc65d06 Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期二, 12 九月 2023 14:53:54 +0800
Subject: [PATCH] 小程序
---
minipro_standard/components/LabelSelection.vue | 43 +++++++++++++++++++++----------------------
1 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/minipro_standard/components/LabelSelection.vue b/minipro_standard/components/LabelSelection.vue
index 6a26a84..65f8438 100644
--- a/minipro_standard/components/LabelSelection.vue
+++ b/minipro_standard/components/LabelSelection.vue
@@ -1,10 +1,10 @@
<template>
<scroll-view class="tag" scroll-x>
<view class="tag_list">
- <view v-for="item in TagList"
- :key="item.id"
- :class="{'tag_item': true, 'tagActive': item.id == activeId}"
- @click="change(item)">
+ <view v-for="(item, index) in TagList"
+ :key="index"
+ :class="{'tag_item': true, 'tagActive': index == activeId}"
+ @click="change(item, index)">
<text>{{item.name}}</text>
<text v-if="isShow && item.num">({{item.num}})</text>
</view>
@@ -21,27 +21,27 @@
},
data() {
return {
- activeId: ''
+ activeId: 0
};
},
methods: {
- change(item) {
- if (this.activeId !== item.id) {
- this.activeId = item.id
+ change(item, index) {
+ if (this.activeId !== index) {
+ this.activeId = index
this.$emit('change', item.id)
}
}
},
watch: {
- TagList: {
- immediate: true,
- handler(news, old) {
- let list = news
- if (list && list.length !== 0) {
- this.activeId = list[0].id
- }
- }
- }
+ // TagList: {
+ // immediate: true,
+ // handler(news, old) {
+ // let list = news
+ // if (list && list.length !== 0) {
+ // this.activeId = list[0].id
+ // }
+ // }
+ // }
}
}
</script>
@@ -77,11 +77,10 @@
flex-shrink: 0;
margin-right: 20rpx;
border: 1rpx solid #CCCCCC;
- text {
- font-size: 26rpx;
- font-weight: 400;
- color: #555555;
- }
+ font-size: 26rpx;
+ font-weight: 400;
+ line-height: 26rpx;
+ color: #555555;
}
}
}
--
Gitblit v1.9.3