feat: 新增按钮防抖指令

Former-commit-id: 45bb712e33986cf77a23a95d04405f7603e8f021
This commit is contained in:
songsy
2022-12-06 12:58:04 +08:00
parent baae5ca613
commit c2da643ac0
2 changed files with 16 additions and 0 deletions

View File

@@ -1 +1,2 @@
export { hasPerm, hasRole } from './permission';
export { deBounce } from './utils';

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)
})
}
}