fix(canvas): 避免离开画布时后续页面无法挂载
画布根节点使用 Teleport,绕开 out-in 过渡以确保返回工作台正常渲染。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -60,6 +60,9 @@ const currentLabel = computed(() => {
|
|||||||
// shell plus a route-label header.
|
// shell plus a route-label header.
|
||||||
const isHome = computed(() => route.path === '/')
|
const isHome = computed(() => route.path === '/')
|
||||||
|
|
||||||
|
// CanvasView's root is a <Teleport to="body"> — keep it outside the
|
||||||
|
// out-in transition so leaving the canvas cannot stall the next page.
|
||||||
|
|
||||||
async function onLogout() {
|
async function onLogout() {
|
||||||
menuOpen.value = false
|
menuOpen.value = false
|
||||||
await logout()
|
await logout()
|
||||||
@@ -184,8 +187,9 @@ async function onLogout() {
|
|||||||
<main :class="['relative z-10 mx-auto max-w-[1400px] pb-24',
|
<main :class="['relative z-10 mx-auto max-w-[1400px] pb-24',
|
||||||
isHome ? 'pt-[58px] px-0' : 'px-4 md:px-8 pt-2',
|
isHome ? 'pt-[58px] px-0' : 'px-4 md:px-8 pt-2',
|
||||||
{ 'public-dark': isDark }]">
|
{ 'public-dark': isDark }]">
|
||||||
<router-view v-slot="{ Component }">
|
<router-view v-slot="{ Component, route: viewRoute }">
|
||||||
<transition name="fade" mode="out-in">
|
<component :is="Component" v-if="viewRoute.path === '/canvas'" />
|
||||||
|
<transition v-else name="fade" mode="out-in">
|
||||||
<component :is="Component" />
|
<component :is="Component" />
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
|
|||||||
Reference in New Issue
Block a user