// 防双击
Vue.directive('preventDbclick', {
bind(el, binding, vnode, oldVnode) {
el.addEventListener('click', () => {
if (!el.disabled) {
el.disabled = true
setTimeout(() => {
el.disabled = false
}, binding.value || 1000)
}
})
}
})
防抖(防双击)
最新推荐文章于 2024-08-25 09:57:22 发布