首页 > 其他 > 详细

vue 实现上下左右滑动(滚动)

时间:2021-04-28 19:04:43      阅读:20      评论:0      收藏:0      [点我收藏+]

在线文档

https://chenxuan1993.gitee.io/component-document/index_prod#/component/seamless-default 

使用vue-seamless-scroll组件

1.安装
npm install vue-seamless-scroll --save
  2.导入
import vueSeamlessScroll from ‘vue-seamless-scroll‘

3.使用组件

            <vueSeamlessScroll :data="noticeList" class="seamless-warp"  :class-option="optionCustomer">
                <ul class="item">
                    <li v-for="item in noticeList">
                      <router-link :to="‘/page/notice/details/‘+item.id">
                        <span style=" font-size:16px;margin:5px 0" v-text="item.name"></span>
                      </router-link>
                    </li>
                </ul>
            </vueSeamlessScroll>
4.设置样式
.seamless-warp {
  line-height:30px;
  height: 60px;
  overflow: hidden;
}

  

5.可通过一些属性设置滚动速度,滚动方向,开始滚动的条数,每次滚动的条数
      optionCustomer: {
        step: 1,
        limitMoveNum: 3,
        openTouch: false,
        waitTime: 50,
        direction: 1,//方向 0 往下 1 往上 2向左 3向右
        singleWidth: 30
      },

  注:我最开始使用的时候就是 没有设置参数,而我的数据又比较少,就没有滚动效果,因为limitMoveNum 的默认条数是5,也就是当数组长度大于等于5的时候才触发滚动

vue 实现上下左右滑动(滚动)

原文:https://www.cnblogs.com/liuna369-4369/p/14714812.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!