1 | /* @flow */
|
2 |
|
3 | import { isDef } from 'shared/util'
|
4 | import { isAsyncPlaceholder } from './is-async-placeholder'
|
5 |
|
6 | export 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 | }
|