diff --git a/packages/runtime-core/src/components/BaseTransition.ts b/packages/runtime-core/src/components/BaseTransition.ts index e99fe0e496c..a290895656a 100644 --- a/packages/runtime-core/src/components/BaseTransition.ts +++ b/packages/runtime-core/src/components/BaseTransition.ts @@ -19,6 +19,7 @@ import { ErrorCodes, callWithAsyncErrorHandling } from '../errorHandling' import { PatchFlags, ShapeFlags, isArray } from '@vue/shared' import { onBeforeUnmount, onMounted } from '../apiLifecycle' import type { RendererElement } from '../renderer' +import type { RawSlots, Slot } from '../componentSlots' type Hook void> = T | T[] @@ -465,7 +466,8 @@ function getKeepAliveChild(vnode: VNode): VNode | undefined { __DEV__ && vnode.component ? vnode.component.subTree : vnode.children - ? ((vnode.children as VNodeArrayChildren)[0] as VNode) + ? ((vnode.children as VNodeArrayChildren)[0] as VNode) || + ((vnode.children as RawSlots).default as Slot)() : undefined : vnode }