1
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
<view class="left"
|
||||
:style="{ top: `${menuInfo.top + menuInfo.height + paddingBtmSize + tabHeadHeight}px` }">
|
||||
<view class="item" v-for="(item, index) in shopList.productInfo" :key="item.id"
|
||||
:class="{ active: titleTopNumIndex == index }" @click="titleClickHandle(item.id,index)">
|
||||
:class="{ active: titleTopNumIndex == index }" @click="titleClickHandle(item.id)">
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -267,8 +267,6 @@
|
||||
showShopInfo: false,
|
||||
showShopsku: false,
|
||||
titleTopNumIndex: 0,
|
||||
titleTopNumIndexFalg: true,
|
||||
timer: null,
|
||||
titleTopNums: [],
|
||||
showCart: false,
|
||||
tableCode: '', //code,
|
||||
@@ -302,7 +300,6 @@
|
||||
backgroundColor: '#000000'
|
||||
});
|
||||
}
|
||||
|
||||
this.countScrollTitle(e.scrollTop);
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -564,7 +561,6 @@
|
||||
}
|
||||
return res
|
||||
})
|
||||
console.log(this.specifications.tagSnap)
|
||||
this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
|
||||
this.skuidname.push(val.children[0])
|
||||
})
|
||||
@@ -633,6 +629,10 @@
|
||||
})
|
||||
return false
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/confirm_order?storeInfo=' + JSON.stringify(this.shopList.storeInfo)
|
||||
});
|
||||
return;
|
||||
uni.navigateTo({
|
||||
url: '/pages/order_detail/indexs?tableId=' + JSON.stringify(this.cartLists)
|
||||
});
|
||||
@@ -691,9 +691,7 @@
|
||||
});
|
||||
},
|
||||
// 点击菜单商品滚动到指定为止
|
||||
titleClickHandle(id, index) {
|
||||
this.titleTopNumIndexFalg = false;
|
||||
this.titleTopNumIndex = index;
|
||||
titleClickHandle(id) {
|
||||
uni.createSelectorQuery()
|
||||
.select('#wrapper')
|
||||
.boundingClientRect((data) => {
|
||||
@@ -716,8 +714,7 @@
|
||||
},
|
||||
// 计算滚动到那个标题
|
||||
countScrollTitle: _.throttle(function(top) {
|
||||
|
||||
if (this.titleTopNums.length > 1 && this.titleTopNumIndexFalg) {
|
||||
if (this.titleTopNums.length > 1) {
|
||||
for (let i = 0; i <= this.titleTopNums.length - 1; i++) {
|
||||
if (top >= this.titleTopNums[i] && top < this.titleTopNums[i + 1]) {
|
||||
this.titleTopNumIndex = i;
|
||||
@@ -727,13 +724,6 @@
|
||||
this.titleTopNumIndex = this.titleTopNums.length - 1;
|
||||
}
|
||||
}
|
||||
//这里必须要每次滚动前 清除一次
|
||||
clearTimeout(this.timer)
|
||||
// 如果停留则表示滚动结束 一旦空了1s就判定为滚动结束
|
||||
this.timer = setTimeout(() => {
|
||||
this.titleTopNumIndexFalg = true;
|
||||
// console.log('结束滚动')
|
||||
}, 1000)
|
||||
}, 100),
|
||||
// 统计每个标题到顶部的距离
|
||||
countTitleTopNum() {
|
||||
@@ -742,9 +732,9 @@
|
||||
uni.createSelectorQuery()
|
||||
.select(`#title${i.id}`)
|
||||
.boundingClientRect((res) => {
|
||||
topNums.push(res.top - this.menuInfo.top - this.menuInfo.height - this
|
||||
.paddingBtmSize * 8 -
|
||||
this.tabHeadHeight + 40);
|
||||
topNums.push(res.top + this.menuInfo.top + this.menuInfo.height + this
|
||||
.paddingBtmSize -
|
||||
this.tabHeadHeight - this.tabHeadHeight / 2);
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user