node.boundingClientRect( rect=>{
console.log('test')
}).exec()
如代码所示,重复调用时,控制台会输出多个'test'。
获取元素都用 wx.createSelectorQuery(),不要用变量代替,不然会循环,亲测有效。
//不要这样 多个的时候就会循环varquery = wx.createSelectorQuery() query .select('.listbox').boundingClientRect(functio(res){}).exec();
//用这种wx.createSelectorQuery().select('.listbox').boundingClientRect(functio(res){}).exec();