swiper下scroll-view无法滚动

发布于 6 年前作者 naqiao18228 次浏览最后编辑 6 年前来自 ask

如题,在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 回复
pmo
pmo1 楼6 年前

试了,没有用

yaoxia
yaoxia2 楼6 年前

顶4楼, 已解决!

xiulanxiao
xiulanxiao3 楼6 年前

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

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

jun86
jun864 楼6 年前

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

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

ming73
ming735 楼6 年前

height:100vh;

用vh vh vh

pingqiao
pingqiao6 楼4 年前

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