mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-19 09:46:40 +08:00
修复transition组件导致的白屏(重现: 热更新transition下的组件script代码切换tab即可)
This commit is contained in:
parent
9913db63bc
commit
14ea36481c
@ -1,14 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<RouterView>
|
<RouterView>
|
||||||
<template #default="{ Component, route }">
|
<template #default="{ Component, route }">
|
||||||
{{ retryKeepAlive(route) }}
|
<template v-if="mode === 'production'">
|
||||||
<transition :name="getTransitionName" mode="out-in" appear>
|
<transition :name="getTransitionName" mode="out-in" appear>
|
||||||
<keep-alive v-if="keepAliveComponents" :include="keepAliveComponents">
|
<keep-alive v-if="keepAliveComponents.length" :include="keepAliveComponents">
|
||||||
<component :is="Component" :key="route.fullPath" />
|
<component :is="Component" :key="route.fullPath" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
<component v-else :is="Component" :key="route.fullPath" />
|
<component v-else :is="Component" :key="route.fullPath" />
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<keep-alive v-if="keepAliveComponents.length" :include="keepAliveComponents">
|
||||||
|
<component :is="Component" :key="route.fullPath" />
|
||||||
|
</keep-alive>
|
||||||
|
<component v-else :is="Component" :key="route.fullPath" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
</RouterView>
|
</RouterView>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -72,11 +79,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const mode = import.meta.env.MODE;
|
||||||
return {
|
return {
|
||||||
keepAliveComponents,
|
keepAliveComponents,
|
||||||
getTransitionName,
|
getTransitionName,
|
||||||
retryKeepAlive,
|
retryKeepAlive,
|
||||||
|
mode,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user