feat: 新增按钮防抖指令

Former-commit-id: 45bb712e33986cf77a23a95d04405f7603e8f021
This commit is contained in:
songsy committed 2022-12-06 12:58:04 +08:00
1 parent baae5ca613
commit c2da643ac0
2 files changed
+16

No files matched your search

+1
View File
@@ -1 +1,2 @@
export { hasPerm, hasRole } from './permission'; export { hasPerm, hasRole } from './permission';
export { deBounce } from './utils';
+15
View File
@@ -0,0 +1,15 @@
import { Directive, DirectiveBinding } from 'vue';
/**
* 按钮防抖
*/
export const deBounce:Directive = {
mounted(el:HTMLElement) {
el.addEventListener('click', e => {
el.classList.add('is-disabled')
setTimeout(() => {
el.classList.remove('is-disabled')
}, 2000)
})
}
}