【优化】优化点餐模式下商品分类的子类切换后,再切换商品大类,子类下标未自动回移到第一下标的问题。

This commit is contained in:
大灰灰
2023-01-01 21:09:48 +08:00
parent 88c65e9812
commit 0307562fe4

View File

@@ -65,7 +65,7 @@
<scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'" @scrolltolower="scrolltolower"> <scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'" @scrolltolower="scrolltolower">
<u-sticky v-if="menuChilds"> <u-sticky v-if="menuChilds">
<view class="coreshop-bg-white coreshop-padding-left-10"> <view class="coreshop-bg-white coreshop-padding-left-10">
<u-tabs :list="menuChilds" :current="childCurrent" :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',fontSize:'14px'}" :inactiveStyle="{color: '#606266',transform: 'scale(1)',fontSize:'14px'}" @change="childIdCheck"></u-tabs> <u-tabs :list="menuChilds" :current="childCurrent" :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',fontSize:'14px'}" :inactiveStyle="{color: '#606266',transform: 'scale(1)',fontSize:'14px'}" @change="clickChange"></u-tabs>
</view> </view>
</u-sticky> </u-sticky>
@@ -295,7 +295,7 @@
this.menuChilds = res.data[0].child; this.menuChilds = res.data[0].child;
this.getGoods(); this.getGoods();
} }
} }
} }
}); });
@@ -439,14 +439,10 @@
this.currentCateId = id; this.currentCateId = id;
this.needCurrentCateId = id; this.needCurrentCateId = id;
this.childCurrent = 1;
console.log('childCurrent', this.childCurrent);
this.menuChilds = []; this.menuChilds = [];
this.menuChilds = _this.menus[index].child; this.menuChilds = _this.menus[index].child;
this.childCurrent = 0; this.childCurrent = 0;
console.log('childCurrent', this.childCurrent);
this.$forceUpdate() this.$forceUpdate()
this.page = 1; this.page = 1;
@@ -454,7 +450,8 @@
this.getGoods(0); this.getGoods(0);
}, },
childIdCheck(e) { clickChange(e) {
this.childCurrent = e.index;
if (e.id != 0) { if (e.id != 0) {
this.needCurrentCateId = e.id; this.needCurrentCateId = e.id;
} else { } else {