swiper下scroll-view无法滚动
发布于 4 年前 作者 naqiao 17837 次浏览 来自 问答

如题,在swiper下scroll-view加了 scroll-x=“true”  scroll-y=“true” enable-back-to-top=“true” style="height: 100%;"还是没有用,无法横向滚动也无法纵向滚动

部分代码如下:

wxml:

     <swiper-item class=“item-list”  >  
       <view class=“list-view”>
              <view class=“classname”>
                <scroll-view class=“scro” scroll-x=“true” scroll-y=“true”
                enable-back-to-top=“true” style=“height: 100%;”
                overflow=“auto”>

wxss:

    .item-list{
  height: 100%;
  /*border: 5px solid red;*/
  text-align: left;
}

.scro{
    height: 100%;
    min-width: 100px;
}

6 回复

试了,没有用

顶4楼, 已解决!

需求是要横向和纵向都能滚动么?

纵向需要设置height, 横向需要设置width, 试试都加上固定值.

一楼的解答不正确,这两种写法完全等价。

在swiper-item和scroll-view之间还有其他view的话,必须给这些view全部设上height:100%才行。

height:100vh;

用vh vh vh

style="height: 100%;"改成__style=“height: 100%”__

回到顶部