createSelectorQuery 获取元素距顶高度不准 有时候还报错
发布于 6 年前 作者 jiesu 543 次浏览 来自 问答
// 获取评论节点信息
queryMultipleNodes: function() {
  var query = wx.createSelectorQuery();
  //选择id
  query.select('.comment-list-wrp').boundingClientRect()
  query.exec((res) => {
    //取高度
    this.setData({
      commentTop: res[0].top
    })
  })
},
 
 
        this.setData({
          comment: result.items,
          current_page: result._meta.currentPage,
          count_page: result._meta.pageCount,
        }, () => { setTimeout(() => { this.queryMultipleNodes()},1000)})

然后偶尔会有这样的问题 是什么问题呢

2 回复

请问这个问题解决了吗

回到顶部