feat: 新增按钮防抖指令
Former-commit-id: 45bb712e33986cf77a23a95d04405f7603e8f021
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export { hasPerm, hasRole } from './permission';
|
||||
export { deBounce } from './utils';
|
||||
|
||||
15
src/directive/utils/index.ts
Normal file
15
src/directive/utils/index.ts
Normal 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)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user