mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-12-04 02:53:36 +08:00
Add layout registration, visual editing, and source generation. Preserve embedded pages and wait for asynchronous layout renderers. Add workspace lint and formatting commands.
19 lines
504 B
TypeScript
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" />
|
|
},
|
|
})
|