vue-seamless-scroll無縫滾動(dòng)

vue項(xiàng)目中有使用文字的無縫滾動(dòng)場(chǎng)景

1,安裝vue-seamless-scroll

npm install vue-seamless-scroll --save

2.? yarn

yarn add vue-seamless-scroll

3.瀏覽器CDN

https://cdn.jsdelivr.net/npm/vue-seamless-scroll@latest/dist/vue-seamless-scroll.min.js

使用

1.全局注冊(cè)

import Vue from 'vue'

import scroll from 'vue-seamless-scroll'

Vue.use(scroll)

//或者

//Vue.use(scroll,{componentName: 'scroll-seamless'})

2.局部注冊(cè)

import vueSeamless from 'vue-seamless-scroll'

? export default {

? ? ? components: {

? ? ? ? vueSeamless}}

3.簡單使用

<div id="app">

? ? <vue-seamless-scroll></vue-seamless-scroll>

</div>

3,參數(shù)配置

// 監(jiān)聽屬性 類似于data概念

? ? ? ? computed: {

? ? ? ? ? ? defaultOption () {

? ? ? ? ? ? ? ? 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)} } },

key? ? ? ? ? ? ? ? ? ? ? ? ? ?description? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?default? ? ? ? ? ? ? ? ? ? ? ? ? ? val

step? ? ? ? ? ? ? ? ? ? ? ?數(shù)值越大速度滾動(dòng)越快? ? ? ? ? ? ? ? ? ? ? ?1? ? ? ? ? ? ? ? ? ? ? ? ? ? Number

limitMoveNum? ? ? ?開啟無縫滾動(dòng)的數(shù)據(jù)量? ? ? ? ? ? ? ? ? ? ? 5? ? ? ? ? ? ? ? ? ? ? ? ? ?Number

hoverStop? ? ? ? ? ? ?是否啟用鼠標(biāo)hover控制? ? ? ? ? ? ? ? ? ?true? ? ? ? ? ? ? ? ? ? ? ? ? Boolean

direction? ? ? ? ? ? ? ? 方向 0 往下 1 往上 2向左 3向右? ? ? ? ?1? ? ? ? ? ? ? ? ? ? ? ? ? ?Number

openTouch? ? ? ? ? ? ? ?移動(dòng)端開啟touch滑動(dòng)? ? ? ? ? ? ? ? ? ? ?true? ? ? ? ? ? ? ? ? ? ? ? ? Boolean

singleHeight? ? ? ? ? ? ? 單步運(yùn)動(dòng)停止的高度(默認(rèn)值0是無縫不停止的滾動(dòng)) direction => 0/1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0? ? ? ? ? ? ? ? ? ? ? ? ? ?Number

singleWidth? ? ? ? ? ? 單步運(yùn)動(dòng)停止的寬度(默認(rèn)值0是無縫不停止的滾動(dòng)) direction => 2/3? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0? ? ? ? ? ? ? ? ? ? ? ? Number

waitTime? ? ? ? ? ? ?單步停止等待時(shí)間(默認(rèn)值1000ms)? ? ? ? ?1000? ? ? ? ? ? ? ? ? Number

switchOffset? ? ? ? ? 左右切換按鈕距離左右邊界的邊距(px)? ? 30? ? ? ? ? ? ? ? ? Number

autoPlay1.1.17? ? ? ? 版本前手動(dòng)切換時(shí)候需要置為false? ? ? ? ? true? ? ? ? ? ? ? ? Boolean

switchSingleStep? ? ? ? 手動(dòng)單步切換step值(px)? ? ? ? ? ? ? ? ? ? ?134? ? ? ? ? ? ? ? ? ? Number

switchDelay? ? ? ? ? ? ? ? 單步切換的動(dòng)畫時(shí)間(ms)? ? ? ? ? ? ? ? ? ? ? 400? ? ? ? ? ? ? ? ? ?Number

switchDisabledClass 不可以點(diǎn)擊狀態(tài)的switch按鈕父元素的類名? ?disabled? ? ? ? String

isSingleRemUnit? ?singleHeight and singleWidth是否開啟rem度量? ? ?false? ? ?Boolean

navigation? ? 左右方向的滾動(dòng)是否顯示控制器按鈕,true的時(shí)候autoPlay自動(dòng)變?yōu)閒alse? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?false? ? ? ? ? ? ? Boolean

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容