mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
解决自定义指令无法自动注册的问题
This commit is contained in:
parent
223badb2ec
commit
2bea8cd73d
@ -72,25 +72,23 @@ export function createModule(app: App) {
|
|||||||
|
|
||||||
if (d) {
|
if (d) {
|
||||||
Object.assign(e, 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 || []));
|
deepMerge(service, mergeService(e.services || []));
|
||||||
|
|
||||||
|
5
src/modules/demo/directives/color.ts
Normal file
5
src/modules/demo/directives/color.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
created(el: HTMLElement, binding: any) {
|
||||||
|
el.style.color = binding.value;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user