uni-app计算scroll-view高度


 

<view :style="{height: scrollHeight}">
    <view class="swiper-item">
        <scroll-view scroll-y style="height: 100%; width: 100%;" lower-threshold="50">      
            <view class="card">内容...</view>
        </scroll-view>
    </view>
</view>     

 

   

onReady() {
    // 计算scroll-view高度
    uni.getSystemInfo({
      success: resu => {
        const query = uni.createSelectorQuery()
        query.select('.swiper-item').boundingClientRect()
        query.exec(res => {
          this.scrollHeight = resu.windowHeight - res[0].top + 'px';
          console.log('打印页面的剩余高度', this.scrollHeight);
        })
      }
    })
 },

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM