您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)vue如何實現(xiàn)循環(huán)滾動列表,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
1.安裝
vue-seamless-scroll 實例文檔鏈接
cnpm install vue-seamless-scroll --save
2.文件中引入,組件配置
import vueSeamlessScroll from 'vue-seamless-scroll'
3.使用
<template> <vue-seamless-scroll :data="CardPartsStatisticsList" class="seamless-warp" :class-option="classOption"> <ul> <li class="DataList_top" v-for="(item,index) in CardPartsStatisticsList" :key="index" v-if="index < 5"> <div class="DataList_left">{{index+1}}</div> <div class="DataList_left">{{item.itemname}}</div> <div class="DataList_left">{{item.number}}</div> </li> </ul> </vue-seamless-scroll> </template> <script> import vueSeamlessScroll from 'vue-seamless-scroll' export default { data() {}, components: { //組件 vueSeamlessScroll }, computed: { classOption () { return { step: 0.2, // 數(shù)值越大速度滾動越快 limitMoveNum: 2, // 開始無縫滾動的數(shù)據(jù)量 this.dataList.length hoverStop: true, // 是否開啟鼠標(biāo)懸停stop direction: 1, // 0向下 1向上 2向左 3向右 openWatch: true, // 開啟數(shù)據(jù)實時監(jiān)控刷新dom singleHeight: 0, // 單步運動停止的高度(默認(rèn)值0是無縫不停止的滾動) direction => 0/1 singleWidth: 0, // 單步運動停止的寬度(默認(rèn)值0是無縫不停止的滾動) direction => 2/3 waitTime: 1000 // 單步運動停止的時間(默認(rèn)值1000ms) } } }, } </script> <style> .seamless-warp{ width: 100%; height: calc(100% - 16px); overflow: hidden; } </style>
關(guān)于vue如何實現(xiàn)循環(huán)滾動列表就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。