uni-app 动态获取元素高度等

uni.getSystemInfo({
  success: function(res) { // res - 各种参数
     console.log(res.windowWidth); // 屏幕的宽度 

      let info = uni.createSelectorQuery().select(".类名");
      info.boundingClientRect(function(data) { //data - 各种参数
      console.log(data.width)  // 获取元素宽度
      }).exec()
       }
});

猜你喜欢

转载自www.cnblogs.com/lymconch/p/11286795.html