Skip to content

Commit

Permalink
fix(runtime-core): properly get keepAlive child (vuejs#10772)
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 authored and buqiyuan committed May 25, 2024
1 parent ab3a3e5 commit 173e29e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/runtime-core/src/components/BaseTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,17 @@ function getKeepAliveChild(vnode: VNode): VNode | undefined {

const { shapeFlag, children } = vnode

if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
return (children as VNodeArrayChildren)[0] as VNode
}
if (children) {
if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
return (children as VNodeArrayChildren)[0] as VNode
}

if (
shapeFlag & ShapeFlags.SLOTS_CHILDREN &&
isFunction((children as any).default)
) {
return (children as any).default()
if (
shapeFlag & ShapeFlags.SLOTS_CHILDREN &&
isFunction((children as any).default)
) {
return (children as any).default()
}
}
}

Expand Down

0 comments on commit 173e29e

Please sign in to comment.