export default {
data() {
return {
timer: null
};
},
methods: {
function() {
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(() => {
//事件逻辑
}, 300); // 设置延迟时间为300毫秒(根据实际需求调整)
}
}
}
vue简单事件防抖
最新推荐文章于 2024-09-17 13:42:29 发布