我是靠谱客的博主 妩媚小刺猬,这篇文章主要介绍VUe滚轮事件,现在分享给大家,希望可以做个参考。

VUe滚轮事件


<div class="index"
@wheel="handleWheel">
//节流函数
throttle (fn, gapTime) {
let _this = this
return function () {
let _nowTime = +new Date()
if (_nowTime - _this._lastTime > gapTime || !_this._lastTime) {
fn(...arguments)// 函数可以带参数
_this._lastTime = _nowTime
}
}
},
handleWheel (e) {
e.stopPropagation()
this.throttle(this.pageUpOrDown, 60)(e);
},
pageUpOrDown (e) {
if (e.deltaY > 0) {
//向下
console.log("正在向下");
} else if (e.deltaY < 0) {
//向上
console.log("正在向上");
}
},

最后

以上就是妩媚小刺猬最近收集整理的关于VUe滚轮事件的全部内容,更多相关VUe滚轮事件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部