一個簡單的基於vue.js的無縫滾動
?在線文檔demo
? 小demo
? English Documenthtml
npm install vue-seamless-scroll --save
詳情的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> // 或者你能夠本身設置全局註冊的組件名 默認註冊的組件名是 vue-seamless-scroll Vue.use(scroll,{componentName: 'scroll-seamless'}) <template> <scroll-seamless></scroll-seamless> </template>
Example:vue
詳情的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>
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 歷史版本.git
若是你想要js無縫滾動(無依賴)你能夠切換到這裏seamscroll。github
vue-simple-spinner is open source and released under the MIT License.npm
vue-seamless-scroll發現bug或者有什麼不足望指點,感受不錯點個star吧。bash