// 防止重复点击指令 export default { install(Vue) { // 防重复点击(指令实现) Vue.directive('preventReClick', { inserted(el, binding) { el.addEventListener('click', () => { if (!el.disabled) { el.disabled = true setTimeout(() => { el.disabled = false }, binding.value || 2000) } }) } }) } }
标签:el,重复,binding,disabled,点击,指令 From: https://www.cnblogs.com/q962286047/p/17576704.html