vue滚动条事件处理
采用window监听onscroll操作
如何使用 安装npm install --save vue-scrollevent
在vue中引用
import vue from 'vue'; import vue-scrollevent from 'vue-scrollevent'; vue.use(vue-scrollevent); 在页面中使用
export default { data () { return { scrolldata: 'no' } }, components: { Hello }, created () { console.log(this) console.log('$scroll' in this) // 装载测试函数 // move测试 this.$scroll.push({ fn (_height) { console.log('move' + _height) }, position: 'move' }); // 到顶测试 this.$scroll.push({ fn () { console.log('go to top') }, position: 'top' }); // 到底测试 // bottom可能需要进行锁定 this.$scroll.push({ fn () { console.log('go to bottom') }, position: 'bottom' }); } }
测试案例
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。