onPageScroll: function (e) { //滚动事件
var that = this, hasMark = false;
that.data.storeGroups.forEach(function (value, index, array) {
console.log(value, array.length)
let query = wx.createSelectorQuery().in(that)
query.select('#theId' + (array.length - 1 - index)).boundingClientRect((res) => {
if (res && res.top < 44 && hasMark === false) {
console.log('res: ', res)
hasMark = true;
that.setData({
title: array[res.dataset.listid].groupName
})
return;
}
if (index === 0 && res.id === 'theId0') {
console.info('index===' + index);
that.setData({
title: ''
})
}
}).exec()
});
},
var that = this, hasMark = false;
that.data.storeGroups.forEach(function (value, index, array) {
console.log(value, array.length)
let query = wx.createSelectorQuery().in(that)
query.select('#theId' + (array.length - 1 - index)).boundingClientRect((res) => {
if (res && res.top < 44 && hasMark === false) {
console.log('res: ', res)
hasMark = true;
that.setData({
title: array[res.dataset.listid].groupName
})
return;
}
if (index === 0 && res.id === 'theId0') {
console.info('index===' + index);
that.setData({
title: ''
})
}
}).exec()
});
},