MCPcopy
hub / github.com/vuejs/core / getInnerChild

Function getInnerChild

packages/runtime-core/src/components/BaseTransition.ts:509–536  ·  view source on GitHub ↗
(vnode: VNode)

Source from the content-addressed store, hash-verified

507}
508
509function getInnerChild(vnode: VNode): VNode | undefined {
510 if (!isKeepAlive(vnode)) {
511 if (isTeleport(vnode.type) && vnode.children) {
512 return findNonCommentChild(vnode.children as VNode[])
513 }
514
515 return vnode
516 }
517 // #7121,#12465 get the component subtree if it's been mounted
518 if (vnode.component) {
519 return vnode.component.subTree
520 }
521
522 const { shapeFlag, children } = vnode
523
524 if (children) {
525 if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
526 return (children as VNodeArrayChildren)[0] as VNode
527 }
528
529 if (
530 shapeFlag & ShapeFlags.SLOTS_CHILDREN &&
531 isFunction((children as any).default)
532 ) {
533 return (children as any).default()
534 }
535 }
536}
537
538export function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void {
539 if (vnode.shapeFlag & ShapeFlags.COMPONENT && vnode.component) {

Callers 1

setupFunction · 0.70

Calls 4

isKeepAliveFunction · 0.90
isTeleportFunction · 0.90
isFunctionFunction · 0.90
findNonCommentChildFunction · 0.85

Tested by

no test coverage detected