uniapp 处理scroll-view 无法滚动

2023-09-24  本文已影响0人  Ths

小程序里使用scroll-view,然后发现在iOS下不能滚动,在安卓下正常。

  1. 先确认scroll-y="true"
  2. 一定需要给scroll-view设置一个高度,具体的根据你自己的页面来 ,可以getSystemInfo获取可视区域的高度
const res = uni.getSystemInfo({
        success:(res=>{
        this.clientHeight = res.windowHeight - getApp().globalData.navHeight - 50;
    })
 });
  1. 给scroll-view加上判断,最后是这样的
<scroll-view v-if="clientHeight != 0" scroll-y="true" :style="{'height': clientHeight + 'px'}">
上一篇 下一篇

猜你喜欢

热点阅读