溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

vue.js怎么實(shí)現(xiàn)無縫滾動效果

發(fā)布時(shí)間:2022-05-05 16:58:52 來源:億速云 閱讀:275 作者:iii 欄目:大數(shù)據(jù)

本篇內(nèi)容主要講解“vue.js怎么實(shí)現(xiàn)無縫滾動效果”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“vue.js怎么實(shí)現(xiàn)無縫滾動效果”吧!

一個(gè)簡單的基于vue.js的無縫滾動

vue.js怎么實(shí)現(xiàn)無縫滾動效果 

:feet:在線文檔demo :ear_of_rice:小demo :blue_book:English Document

安裝

NPM

npm install vue-seamless-scroll --save

使用

ES6

詳情的demo頁面 example-src/App.vue

// **main.js**
import Vue from 'vue'
import scroll from 'vue-seamless-scroll'
Vue.use(scroll)
<template>
 <vue-seamless-scroll></vue-seamless-scroll>
</template>
// 或者你可以自己設(shè)置全局注冊的組件名 默認(rèn)注冊的組件名是 vue-seamless-scroll
Vue.use(scroll,{componentName: 'scroll-seamless'})
<template>
 <scroll-seamless></scroll-seamless>
</template>

普通的使用方法 (script標(biāo)簽引入)

Example:

詳情的demo頁面 test/test.html

<html>
<head>
 ...
</head>
<body>
 <div id="app">
  <vue-seamless-scroll></vue-seamless-scroll>
 </div>
 <script src="vue.js"></script>
 <script src="vue-seamless-scroll"></script>
 <script>
  new Vue({
   el: '#app'
  })
 </script>
</body>
</html>

配置項(xiàng)默認(rèn)值

defaultOption () {
    return {
     step: 1, //數(shù)值越大速度滾動越快
     limitMoveNum: 5, //開始無縫滾動的數(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)動停止的高度(默認(rèn)值0是無縫不停止的滾動) direction => 0/1
     singleWidth: 0, //單步運(yùn)動停止的寬度(默認(rèn)值0是無縫不停止的滾動) direction => 2/3
     waitTime: 1000 //單步運(yùn)動停止的時(shí)間(默認(rèn)值1000ms)
    }
   }

到此,相信大家對“vue.js怎么實(shí)現(xiàn)無縫滾動效果”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI