zoukankan      html  css  js  c++  java
  • 关于小程序 scroll-view 左右横向滑动没有效果(无法滑动)问题

    小程序组件 scroll-view 中分别有上下竖向滑动和左右横向滑动之分,在这次项目中刚好需要用到横向滑动,但在测试过程中发现横向滑动没有了效果(静止在那里没移动过),经调试发现:

    1.scroll-view 中的需要滑动的元素不可以用 float 浮动;

    2.scroll-view 中的包裹需要滑动的元素的大盒子用 display:flex; 是没有作用的;

    3.scroll-view 中的需要滑动的元素要用 dislay:inline-block; 进行元素的横向编排;

    4.包裹 scroll-view 的大盒子有明确的宽和加上样式-->  overflow:hidden;white-space:nowrap;

    具体的测试代码如下:

    <view class="scroll_box"> 
        <scroll-view class="scroll-view_x" scroll-x style=" auto;overflow:hidden;">
    
          <view class="item_list" wx:for="{{list}}">
            <image src="../../images/head.jpg" class="item_book_img" mode="aspectFill"></image>
            <view class="item_book_text">测试数据</view>
          </view>
         
        </scroll-view>
      </view>
    .scroll_box{
    width: 100%;
    height: 307rpx;
    overflow: hidden;
    padding: 20rpx;
    background: #fff;
    white-space: nowrap;
    }
    .item_list{
    width: 160rpx;
    height: auto;
    margin-right: 23rpx;
    display: inline-block;
    }

    得到的具体效果如下:

    转 : https://www.cnblogs.com/miu-key/p/7606024.html

  • 相关阅读:
    Solaris 默认Shell 修改
    关系数组
    文件描述符 文件操作 <> open 文件句柄
    IO 双引号 输出 输入
    第五章答案
    子例程 subroutine
    钻石操作符
    花括号的使用 printf %${width}s , 否则会 去找 $widths
    print reverse <> 是打印全部的文件内容 ?
    hihoCoder#1239 Fibonacci
  • 原文地址:https://www.cnblogs.com/fps2tao/p/12123528.html
Copyright © 2011-2022 走看看