小程序组件中获取指定元素报错怎么办

108 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

例如获取id为box的元素信息

 wx.createSelectorQuery().selectAll('#box').boundingClientRect(function (res) {
    console.log(res)//小程序组建中不会返回#box元素的信息
 }).exec()
  const $ = wx.createSelectorQuery().in(this)
  $.selectAll('.scroll-number').boundingClientRect(function (res) {
        
  }).exec()