Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 3x 3x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 14x 14x 8x 14x 6x 6x 12x 12x 6x 14x | import { ShapeFlags } from '@vue/shared'
import type { ComponentInternalInstance } from '../component'
import type { ComponentPublicInstance } from '../componentPublicInstance'
import type { VNode } from '../vnode'
import { DeprecationTypes, assertCompatEnabled } from './compatConfig'
export function getCompatChildren(
instance: ComponentInternalInstance,
): ComponentPublicInstance[] {
assertCompatEnabled(DeprecationTypes.INSTANCE_CHILDREN, instance)
const root = instance.subTree
const children: ComponentPublicInstance[] = []
if (root) {
walk(root, children)
}
return children
}
function walk(vnode: VNode, children: ComponentPublicInstance[]) {
if (vnode.component) {
children.push(vnode.component.proxy!)
} else if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
const vnodes = vnode.children as VNode[]
for (let i = 0; i < vnodes.length; i++) {
walk(vnodes[i], children)
}
}
}
|