uniapp 动态获取元素高度等信息

uni.getSystemInfo({
      success: function(res) { // res - 各种参数
        console.log(res.windowWidth); // 屏幕的宽度 
        let info = uni.createSelectorQuery().select(".search");
        info.boundingClientRect(function(data) { //data - 各种参数
           console.log(data.height,'dddd')  // 获取元素高度
        }).exec()
      }
});

 

posted @ 2021-12-09 09:32  辉仔的前端之路  阅读(1330)  评论(0)    收藏  举报