fix: wait for slot declaration via slots.inject and id list-slot entries

This commit is contained in:
2026-09-04 15:22:37 +08:00
parent ef9508e597
commit 92289b17ed
3 changed files with 32 additions and 6 deletions
+16 -2
View File
@@ -60,12 +60,26 @@ function WorkbenchOverlay() {
export function apply(ctx) {
injectStyles()
// 插槽须等宿主声明后才能注册:slots.inject 会等待座位声明(顺序安全),
// 直接 register 在我们先于 ui-sidebar/ui-layout 加载时会报“slot is not declared”。
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',
)
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',
)
}