feat: 新增点击空白关闭指令

Former-commit-id: b972dcaec196fe3e5a261cebfece91d3596a51ab
This commit is contained in:
haoxr
2023-01-21 15:35:15 +08:00
parent 919bedcc0e
commit 3924565087
4 changed files with 71 additions and 3 deletions

View File

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