- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径pages/food/catering
- 提供一个最简复现 Demo
wxml 太多 无法提供
使用的是scroll-view
下面是滚动事件 样式布局属于正常
滚动事件的渲染出现了比较严重的延迟 无法达到预期效果
从而演变为bug 其中安卓(vivox7)手机最为明显 苹果(7ps)手机没有出现
scroll: function(e) {
var self = this;
var height = self.data.height
var TopHeight;
var opos = self.data.opos;
if (self.data.soll == false) {
if (e.detail.scrollTop > height) {
if (isOpps == false) {
isOpps = true;
opos = true,
height = e.detail.scrollTop
if (e.detail.scrollTop <= 270) {
TopHeight = 270
}
}
} else {
if (isOpps == true) {
isOpps = false
opos = false
}
}
self.setData({
TopHeight: TopHeight,
opos: opos,
height: height
})
}
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(function() {
var fyArrId = self.data.fyArrId
var GcArr = self.data.firstClass
console.log(GcArr)
if (self.data.soll == false) {
// 判断 距离
var scale = e.detail.scrollWidth / 600,
scrollTop = e.detail.scrollTop / scale,
h = 0,
classifySeleted = 0;
// self.data.GcArr.forEach(function(classify, i) {
// // 标题栏 70
// // 每项的个数 classify.goods.length
// var _h = 96 + classify.goodsjson.length * 174;
// if (scrollTop >= h) {
// classifySeleted = fyArrId[i].gc_id;
// }
// h += _h;
// });
for (var i = 0; i < fyArrId.length; i++) {
if (scrollTop >= fyArrId[i]) {
classifySeleted = GcArr[i].gc_id;
}
}
console.log(“pp” + classifySeleted)
self.setData({
flId: classifySeleted
});
} else {
self.setData({
soll: false
});
}
timer = undefined;
}, 100)
},