UNPKG

409 BJavaScriptView Raw
1/* @flow */
2
3import { isDef } from 'shared/util'
4import { isAsyncPlaceholder } from './is-async-placeholder'
5
6export function getFirstComponentChild (children: ?Array<VNode>): ?VNode {
7 if (Array.isArray(children)) {
8 for (let i = 0; i < children.length; i++) {
9 const c = children[i]
10 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
11 return c
12 }
13 }
14 }
15}