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滚轮事件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复