// 节流处理
const on = Vue.prototype.$on
Vue.prototype.$on = function (event, func) {
let previous = 0
let newFunc = func
if (event === 'click') {
newFunc = function () {
const now = new Date().getTime()
if (previous + 1000 <= now) {
func.apply(this, arguments)
previous = now
}
}
}
on.call(this, event, newFunc)
}
vue全局节流处理
最新推荐文章于 2023-12-25 11:13:23 发布