mirror of https://github.com/vuejs/core.git
refactor: extract dynamicChildren
This commit is contained in:
parent
339a658cef
commit
c53af4d57d
|
@ -169,9 +169,14 @@ function transformChildren(
|
|||
const childrenTemplate: string[] = []
|
||||
children.forEach((child, i) => walkNode(child, i))
|
||||
|
||||
processDynamicChildren()
|
||||
ctx.template += childrenTemplate.join('')
|
||||
|
||||
if (root) ctx.registerTemplate()
|
||||
|
||||
function processDynamicChildren() {
|
||||
let prevChildren: DynamicInfo[] = []
|
||||
let hasStatic = false
|
||||
|
||||
for (let index = 0; index < children.length; index++) {
|
||||
const child = ctx.dynamic.children[index]
|
||||
|
||||
|
@ -212,11 +217,7 @@ function transformChildren(
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
ctx.template += childrenTemplate.join('')
|
||||
|
||||
// finalize template
|
||||
if (root) ctx.registerTemplate()
|
||||
}
|
||||
|
||||
function walkNode(node: TemplateChildNode, index: number) {
|
||||
const child = createContext(node, ctx, index)
|
||||
|
|
Loading…
Reference in New Issue