diff --git a/src/cool/bootstrap/module.ts b/src/cool/bootstrap/module.ts index b077bb2..3eaa595 100644 --- a/src/cool/bootstrap/module.ts +++ b/src/cool/bootstrap/module.ts @@ -72,25 +72,23 @@ export function createModule(app: App) { if (d) { Object.assign(e, d); - - // 注册组件 - e.components?.forEach(async (c: any) => { - const v = await (isFunction(c) ? c() : c); - const n = v.default || v; - app.component(n.name, n); - }); - - // 注册指令 - e.directives?.forEach((v) => { - app.directive(v.name, v.value); - }); - - // 安装事件 - if (d.install) { - d.install(app, d.options); - } } + // 安装事件 + e.install?.(app, d.options); + + // 注册组件 + e.components?.forEach(async (c: any) => { + const v = await (isFunction(c) ? c() : c); + const n = v.default || v; + app.component(n.name, n); + }); + + // 注册指令 + e.directives?.forEach((v) => { + app.directive(v.name, v.value); + }); + // 合并 deepMerge(service, mergeService(e.services || [])); diff --git a/src/modules/demo/directives/color.ts b/src/modules/demo/directives/color.ts new file mode 100644 index 0000000..8c5b1c6 --- /dev/null +++ b/src/modules/demo/directives/color.ts @@ -0,0 +1,5 @@ +export default { + created(el: HTMLElement, binding: any) { + el.style.color = binding.value; + } +};