自定义组件setdata回调中SelectorQuery.selectAll获取高度不准怎么破?
this.setData(obj, () => {
wx.nextTick(() => {
this.init(cb)
})
})
const query = wx.createSelectorQuery().in(this);
let fieldsobj = {
id: true,
size: true,
scrollOffset: true,
rect: true,
dataset: true
}
query.selectAll('.vkey' + this.batch).fields(fieldsobj, res => {
temparr = res;
console.log(res)
this.layoutinit(temparr, cb);
}).exec();
layoutinit(arr, cb) {
arr.forEach((e, i) => {
console.log('arr,h',arr,e.height)
}
}
开发者工具中偶尔获取所有元素高度相同,真机调试偶尔获取所有元素高度相同。体验版,100%获取所有元素高度相同。但实际表现情况并不相同。 [图片]