From 64a7f738aadbf552bfb1ce24c46b1924767bf526 Mon Sep 17 00:00:00 2001 From: Mr.Zhang <710666463@qq.com> Date: 星期二, 05 九月 2023 16:00:16 +0800 Subject: [PATCH] 小程序 --- minipro_standard/components/LabelSelection.vue | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/minipro_standard/components/LabelSelection.vue b/minipro_standard/components/LabelSelection.vue index 6a26a84..0bde662 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> @@ -80,6 +80,7 @@ text { font-size: 26rpx; font-weight: 400; + line-height: 26rpx; color: #555555; } } -- Gitblit v1.9.3