一个简单的基于vue.js的无缝滚动
: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>// 或者你可以自己设置全局注册的组件名 默认注册的组件名是 vue-seamless-scrollvue.use(scroll,{componentname: 'scroll-seamless'})<template> <scroll-seamless></scroll-seamless></template>
普通的使用方法 (script标签引入)
example:
详情的demo页面 test/test.html
<html><head> ...</head><body> <p id="app"> <vue-seamless-scroll></vue-seamless-scroll> </p> <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) } }
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
angularjs双向数据绑定原理(详细教程)
在javascript中如何计算多边形质心
在微信小程序中如何使用switch开关选择器
详细解读angular有关报错404问题
在微信小程序中如何使用slider组件
以上就是使用vue.js如何实现无缝滚动效果的详细内容。
