這篇文章給大家分享的是有關(guān)vue.js怎么實(shí)現(xiàn)列表滾動(dòng)循環(huán)的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
成都創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè)與策劃設(shè)計(jì),石樓網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:石樓等地區(qū)。石樓做網(wǎng)站價(jià)格咨詢:13518219792
vue.js實(shí)現(xiàn)列表滾動(dòng)循環(huán)的方法:1、安裝vue-seamless-scroll;2、在文件中引入vue-seamless-scroll,并配置組件;3、使用vue-seamless-scroll即可。
本文操作環(huán)境:windows10系統(tǒng)、vue.js 2.9、thinkpad t480電腦。
首先我們要安裝vue-seamless-scroll
點(diǎn)擊下方的鏈接可以查看演示文檔。
實(shí)例文檔鏈接
cnpm install vue-seamless-scroll --save
接著在文件中引入,并配置組件配置
import vueSeamlessScroll from 'vue-seamless-scroll'
最后使用它就好了,如下:
<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ù)值越大速度滾動(dòng)越快 limitMoveNum: 2, // 開始無縫滾動(dòng)的數(shù)據(jù)量 this.dataList.length hoverStop: true, // 是否開啟鼠標(biāo)懸停stop direction: 1, // 0向下 1向上 2向左 3向右 openWatch: true, // 開啟數(shù)據(jù)實(shí)時(shí)監(jiān)控刷新dom singleHeight: 0, // 單步運(yùn)動(dòng)停止的高度(默認(rèn)值0是無縫不停止的滾動(dòng)) direction => 0/1 singleWidth: 0, // 單步運(yùn)動(dòng)停止的寬度(默認(rèn)值0是無縫不停止的滾動(dòng)) direction => 2/3 waitTime: 1000 // 單步運(yùn)動(dòng)停止的時(shí)間(默認(rèn)值1000ms) } } }, } </script> <style> .seamless-warp{ width: 100%; height: calc(100% - 16px); overflow: hidden; } </style>
感謝各位的閱讀!關(guān)于“vue.js怎么實(shí)現(xiàn)列表滾動(dòng)循環(huán)”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
網(wǎng)頁名稱:vue.js怎么實(shí)現(xiàn)列表滾動(dòng)循環(huán)
文章源于:http://chinadenli.net/article32/ihcssc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、面包屑導(dǎo)航、網(wǎng)站改版、虛擬主機(jī)、網(wǎng)站制作、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)