Skip to content

Commit 6395d07

Browse files
committed
fix(elevator): click highLight error(#1151)
1 parent 7a11bdc commit 6395d07

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/packages/__VUE/elevator/index.taro.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
<view class="nut-elevator__list__item__code">{{ item[acceptKey] }}</view>
1717
<view
1818
class="nut-elevator__list__item__name"
19-
:class="{ 'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id }"
19+
:class="{
20+
'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id && currentKey === item[acceptKey]
21+
}"
2022
v-for="subitem in item.list"
2123
:key="subitem['id']"
2224
@click="handleClickItem(item[acceptKey], subitem)"
@@ -85,7 +87,8 @@ export default create({
8587
currentIndex: 0,
8688
query: Taro.createSelectorQuery(),
8789
scrollTop: 0,
88-
currentData: {} as ElevatorData
90+
currentData: {} as ElevatorData,
91+
currentKey: ''
8992
});
9093
9194
const classes = computed(() => {
@@ -171,6 +174,7 @@ export default create({
171174
const handleClickItem = (key: string, item: ElevatorData) => {
172175
context.emit('click-item', key, item);
173176
state.currentData = item;
177+
state.currentKey = key;
174178
};
175179
176180
const handleClickIndex = (key: string) => {

src/packages/__VUE/elevator/index.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
<view class="nut-elevator__list__item__code">{{ item[acceptKey] }}</view>
66
<view
77
class="nut-elevator__list__item__name"
8-
:class="{ 'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id }"
8+
:class="{
9+
'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id && currentKey === item[acceptKey]
10+
}"
911
v-for="subitem in item.list"
1012
:key="subitem['id']"
1113
@click="handleClickItem(item[acceptKey], subitem)"
@@ -71,7 +73,8 @@ export default create({
7173
},
7274
scrollStart: false,
7375
currentIndex: 0,
74-
currentData: {} as ElevatorData
76+
currentData: {} as ElevatorData,
77+
currentKey: ''
7578
});
7679
7780
const classes = computed(() => {
@@ -152,6 +155,7 @@ export default create({
152155
const handleClickItem = (key: string, item: ElevatorData) => {
153156
context.emit('click-item', key, item);
154157
state.currentData = item;
158+
state.currentKey = key;
155159
};
156160
157161
const handleClickIndex = (key: string) => {

0 commit comments

Comments
 (0)