其他分享
首页 > 其他分享> > uni-app 计算scroll-view高度

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);
        })
      }
    })
 },

 

标签:res,app,resu,query,uni,scroll,scrollHeight
来源: https://www.cnblogs.com/Blogzlj/p/15070935.html