uniapp 獲取scroll-view 高度的問題

        // 計算屏幕剩餘高度  填補剩餘高度
            let _this = this
            uni.getSystemInfo({
                success(res) {
                    _this.phoneHeight = res.windowHeight
                    console.log(res.windowHeight)
                    // 計算組件的高度
                    let view = uni.createSelectorQuery().select(".hd-height")
                    view.boundingClientRect(data => {
                        _this.navHeight = data.height
                        console.log(_this.navHeight)
                        _this.scrollviewHigh = _this.phoneHeight - _this.navHeight
                
                    }).exec()
                }
            })this

最後強制綁定style  get

得到的高度單位是 px  不是 console

相關文章
相關標籤/搜索