ray-template/apps/admin/src/layout/blocks/OutletTarget.tsx
XiaoDaiGua-Ray 22dfe441e0
feat(layout): add a composable workspace designer
Add layout registration, visual editing, and source generation.

Preserve embedded pages and wait for asynchronous layout renderers.

Add workspace lint and formatting commands.
2026-12-01 17:34:27 +08:00

19 lines
504 B
TypeScript

import { layoutHostKey } from '../host-context'
export default defineComponent({
name: 'LayoutOutletTarget',
setup() {
const host = inject(layoutHostKey)
if (!host)
throw new Error('LayoutOutlet requires the application layout host.')
const element = useTemplateRef<HTMLDivElement>('element')
onMounted(() => host.addOutlet(element.value!))
onBeforeUnmount(() => host.removeOutlet(element.value!))
return () => <div ref="element" class="r-layout-outlet" />
},
})