Skip to content

Commit

Permalink
fix(runtime-core): properly get keepAlive child (#10772)
Browse files Browse the repository at this point in the history
close #10771
  • Loading branch information
edison1105 committed Apr 24, 2024
1 parent 958286e commit 3724693
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/runtime-core/src/components/BaseTransition.ts
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 3724693

Please sign in to comment.