2***@qq.com
2***@qq.com
  • 发布:2025-04-11 20:45
  • 更新:2025-04-11 20:52
  • 阅读:53

uni.createSelectorQuery().in(instance).select(".data").boundingClientRect((rect) => 其中rect无法取出里面的值

分类:uni-app x
这是我的代码  

    const instance = getCurrentInstance();  
    uni.createSelectorQuery().in(instance).select(".data").boundingClientRect((rect) => {  
        console.log(rect.height)  
        })  
        .exec();  

编译到安卓APP的时候会报错

20:43:53.326 [plugin:uni:app-uts] 编译失败
20:43:53.326 ‌error: Unresolved reference: height‌
20:43:53.326 at components/fold/fold.uvue:69:20
20:43:53.328 67 | const instance = getCurrentInstance();
20:43:53.328 68 | uni.createSelectorQuery().in(instance).select(".data").boundingClientRect((rect) => {
20:43:53.328 69 | console.log(rect.height)
20:43:53.328 | ^
20:43:53.328 70 | })
20:43:53.328 71 | .exec();
试过了很多种方法,怎么都取不出里面的height

2025-04-11 20:45 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

用浏览器运行的话可以打印出来

要回复问题请先登录注册