fix(nuxt): change the name of the RouteProvider componet when keepalive

This commit is contained in:
jilixiang 2024-07-18 20:29:56 +08:00
parent 42ef331816
commit e5b4e15110

View File

@ -126,7 +126,7 @@ export default defineComponent({
trackRootNodes: hasTransition, trackRootNodes: hasTransition,
vnodeRef: pageRef, vnodeRef: pageRef,
}) })
if (import.meta.client && keepaliveConfig) { if (import.meta.client && keepaliveConfig && !(providerVNode.type as any).name) {
(providerVNode.type as any).name = (routeProps.Component.type as any).name || (routeProps.Component.type as any).__name || 'RouteProvider' (providerVNode.type as any).name = (routeProps.Component.type as any).name || (routeProps.Component.type as any).__name || 'RouteProvider'
} }
return providerVNode return providerVNode