啊童
啊童
  • 发布:2021-07-06 15:16
  • 更新:2021-07-07 15:10
  • 阅读:918

uni.createSelectorQuery()在iphone手机中返回高度为0,Android手机中可正常获取元素高度,是什么原因呢?

分类:uni-app

在组件中使用uni.createSelectorQuery(),Android手机可获取到组件元素高度。iPhone手机获取组件元素高度为0;

<u-parse id="sunui-grand-summary-id" :content="content" @preview="preview" @navigate="navigate" />  
    onReady() {  
            let that = this  
            that.$nextTick(() => {  
                setTimeout(res => {  
                    uni.createSelectorQuery().in(that).selectAll("#sunui-grand-summary-id")  
                        .boundingClientRect(  
                            resp => {  
                                console.log(resp, '文本高度22');  
                                if (resp[0].height >= 64) {  
                                    that.showBtn = true  
                                } else {  
                                    that.showBtn = false  
                                }  
                            }).exec();  
                }, 0)  
            })  
        },
2021-07-06 15:16 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

APP 还是小程序?

注意时机,延迟是否准确,是否 u-parse 已经解析完毕

该问题目前已经被锁定, 无法添加新回复