微信小程序,获取组件的高度width、宽度height、id、left、right、top、bottom等信息

 

 

hideShFn() {
    var query = wx.createSelectorQuery();
    query.select('.enterP_01100').boundingClientRect(rect => {
      if (rect.height > 60) {
        this.setData({
          hideShow: true
        })
      } else {
        this.setData({
          hideShow: false
        })
      }
    }).exec()
  },
 
 
 
rect.id      // 节点的ID
rect.dataset // 节点的dataset
rect.left    // 节点的左边界坐标
rect.right   // 节点的右边界坐标
rect.top     // 节点的上边界坐标
rect.bottom  // 节点的下边界坐标
rect.width   // 节点的宽度
rect.height  // 节点的高度
posted @ 2021-08-17 16:32  蠡li  阅读(1130)  评论(1编辑  收藏  举报