fix: wait for slot declaration via slots.inject and id list-slot entries
This commit is contained in:
@@ -60,12 +60,26 @@ function WorkbenchOverlay() {
|
|||||||
|
|
||||||
export function apply(ctx) {
|
export function apply(ctx) {
|
||||||
injectStyles()
|
injectStyles()
|
||||||
|
// 插槽须等宿主声明后才能注册:slots.inject 会等待座位声明(顺序安全),
|
||||||
|
// 直接 register 在我们先于 ui-sidebar/ui-layout 加载时会报“slot is not declared”。
|
||||||
ctx.effect(
|
ctx.effect(
|
||||||
() => ctx.slots.register({ name: 'sidebar.footer.action' }, WorkbenchFooterAction),
|
() =>
|
||||||
|
ctx.slots.inject('sidebar.footer.action', () =>
|
||||||
|
ctx.slots.register(
|
||||||
|
{ name: 'sidebar.footer.action', id: 'gyxx-workbench.footer' },
|
||||||
|
WorkbenchFooterAction,
|
||||||
|
),
|
||||||
|
),
|
||||||
'gyxx-workbench: footer action',
|
'gyxx-workbench: footer action',
|
||||||
)
|
)
|
||||||
ctx.effect(
|
ctx.effect(
|
||||||
() => ctx.slots.register({ name: 'shell.overlay' }, WorkbenchOverlay),
|
() =>
|
||||||
|
ctx.slots.inject('shell.overlay', () =>
|
||||||
|
ctx.slots.register(
|
||||||
|
{ name: 'shell.overlay', id: 'gyxx-workbench.overlay' },
|
||||||
|
WorkbenchOverlay,
|
||||||
|
),
|
||||||
|
),
|
||||||
'gyxx-workbench: overlay',
|
'gyxx-workbench: overlay',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -556,11 +556,23 @@ function WorkbenchOverlay() {
|
|||||||
function apply(ctx) {
|
function apply(ctx) {
|
||||||
injectStyles();
|
injectStyles();
|
||||||
ctx.effect(
|
ctx.effect(
|
||||||
() => ctx.slots.register({ name: "sidebar.footer.action" }, WorkbenchFooterAction),
|
() => ctx.slots.inject(
|
||||||
|
"sidebar.footer.action",
|
||||||
|
() => ctx.slots.register(
|
||||||
|
{ name: "sidebar.footer.action", id: "gyxx-workbench.footer" },
|
||||||
|
WorkbenchFooterAction
|
||||||
|
)
|
||||||
|
),
|
||||||
"gyxx-workbench: footer action"
|
"gyxx-workbench: footer action"
|
||||||
);
|
);
|
||||||
ctx.effect(
|
ctx.effect(
|
||||||
() => ctx.slots.register({ name: "shell.overlay" }, WorkbenchOverlay),
|
() => ctx.slots.inject(
|
||||||
|
"shell.overlay",
|
||||||
|
() => ctx.slots.register(
|
||||||
|
{ name: "shell.overlay", id: "gyxx-workbench.overlay" },
|
||||||
|
WorkbenchOverlay
|
||||||
|
)
|
||||||
|
),
|
||||||
"gyxx-workbench: overlay"
|
"gyxx-workbench: overlay"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user