解决自定义指令无法自动注册的问题

This commit is contained in:
icssoa 2023-03-23 11:07:30 +08:00
parent 223badb2ec
commit 2bea8cd73d
2 changed files with 20 additions and 17 deletions

View File

@ -72,6 +72,10 @@ export function createModule(app: App) {
if (d) {
Object.assign(e, d);
}
// 安装事件
e.install?.(app, d.options);
// 注册组件
e.components?.forEach(async (c: any) => {
@ -85,12 +89,6 @@ export function createModule(app: App) {
app.directive(v.name, v.value);
});
// 安装事件
if (d.install) {
d.install(app, d.options);
}
}
// 合并
deepMerge(service, mergeService(e.services || []));

View File

@ -0,0 +1,5 @@
export default {
created(el: HTMLElement, binding: any) {
el.style.color = binding.value;
}
};