自定义组件不支持节点信息

发布于 7 年前作者 guiying8914624 次浏览最后编辑 7 年前来自 ask

如题:自定义组件不支持节点信息。

代码大概是这样,得到的是 null

Component({
  ready: function () {
    this.getHeight(res => {})
  },
  getHeight: function (callback) {
    wx.createSelectorQuery().select('.flex-tabs').boundingClientRect(rect => {
      console.log(rect)
    }).exec()
  },
})

元素也当然是存在的,这是BUG还是设定如此呢?

2 回复
ptao
ptao1 楼6 年前

需求比较宽松,所以暂时按固定尺寸来做的。

但还是希望 @官方 能支持一下这个功能。

chao80
chao802 楼5 年前

我也遇到这个问题了,怎么解决的