z自定义指令

This commit is contained in:
李志鹏
2026-05-14 14:23:32 +08:00
parent 2ab2466f3d
commit 25919e5b1b
8 changed files with 155 additions and 92 deletions

10
src/directives/index.ts Normal file
View File

@@ -0,0 +1,10 @@
import type { App } from 'vue'
export default {
install(app: App) {
const directivesList = import.meta.glob('./*.ts', { eager: true }) as any;
Object.keys(directivesList).forEach(key => {
app.directive(directivesList[key].default.name, directivesList[key].default);
});
}
};