一個簡單的基於vue.js的無縫滾動html
🐾在線文檔demo 🌾 小demo 📘 English Document vue
npm install vue-seamless-scroll --save
複製代碼
詳情的demo頁面 example-src/App.vuegit
// **main.js**
import Vue from 'vue'
import scroll from 'vue-seamless-scroll'
Vue.use(scroll)
<template>
<vue-seamless-scroll></vue-seamless-scroll> </template>
// 或者你能夠本身設置全局註冊的組件名 默認註冊的組件名是 vue-seamless-scroll
Vue.use(scroll,{componentName: 'scroll-seamless'})
<template>
<scroll-seamless></scroll-seamless> </template>
複製代碼
Example:github
詳情的demo頁面 test/test.htmlnpm
<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>
複製代碼
defaultOption () {
return {
step: 1, //數值越大速度滾動越快
limitMoveNum: 5, //開始無縫滾動的數據量 //this.dataList.length
hoverStop: true, //是否開啓鼠標懸停stop
direction: 1, // 0向下 1向上 2向左 3向右
openWatch: true, //開啓數據實時監控刷新dom
singleHeight: 0, //單步運動中止的高度(默認值0是無縫不中止的滾動) direction => 0/1
singleWidth: 0, //單步運動中止的寬度(默認值0是無縫不中止的滾動) direction => 2/3
waitTime: 1000 //單步運動中止的時間(默認值1000ms)
}
}
複製代碼
See the GitHub 歷史版本.bash
若是你想要js無縫滾動(無依賴)你能夠切換到這裏seamscroll。app
vue-simple-spinner is open source and released under the MIT License.less
vue-seamless-scroll發現bug或者有什麼不足望指點,感受不錯點個star吧。dom