mirror of https://github.com/vuejs/core.git
refactor(compiler-vapor): decoupe insert and non-template
This commit is contained in:
parent
79636ddc5b
commit
22436ea341
|
|
@ -318,12 +318,7 @@ function genChildren(children: IRDynamicChildren) {
|
||||||
let offset = 0
|
let offset = 0
|
||||||
for (const [index, child] of Object.entries(children)) {
|
for (const [index, child] of Object.entries(children)) {
|
||||||
const childrenLength = Object.keys(child.children).length
|
const childrenLength = Object.keys(child.children).length
|
||||||
if (
|
if (child.dynamicFlags & DynamicFlag.NON_TEMPLATE) {
|
||||||
child.dynamicFlags & DynamicFlag.NON_TEMPLATE ||
|
|
||||||
(child.dynamicFlags & DynamicFlag.INSERT &&
|
|
||||||
child.placeholder === null &&
|
|
||||||
childrenLength === 0)
|
|
||||||
) {
|
|
||||||
offset--
|
offset--
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export const transformInterpolation: NodeTransform = (node, ctx) => {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const id = ctx.reference()
|
const id = ctx.reference()
|
||||||
ctx.dynamic.dynamicFlags |= DynamicFlag.INSERT
|
ctx.dynamic.dynamicFlags |= DynamicFlag.INSERT | DynamicFlag.NON_TEMPLATE
|
||||||
ctx.registerOperation({
|
ctx.registerOperation({
|
||||||
type: IRNodeTypes.CREATE_TEXT_NODE,
|
type: IRNodeTypes.CREATE_TEXT_NODE,
|
||||||
loc: node.loc,
|
loc: node.loc,
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ export function processIf(
|
||||||
dir.exp = createSimpleExpression(`true`, false, loc)
|
dir.exp = createSimpleExpression(`true`, false, loc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.dynamic.dynamicFlags |= DynamicFlag.NON_TEMPLATE
|
||||||
if (dir.name === 'if') {
|
if (dir.name === 'if') {
|
||||||
const id = context.reference()
|
const id = context.reference()
|
||||||
context.dynamic.dynamicFlags |= DynamicFlag.INSERT
|
context.dynamic.dynamicFlags |= DynamicFlag.INSERT
|
||||||
|
|
@ -58,8 +59,6 @@ export function processIf(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.dynamic.dynamicFlags |= DynamicFlag.NON_TEMPLATE
|
|
||||||
|
|
||||||
// check the adjacent v-if
|
// check the adjacent v-if
|
||||||
const parent = context.parent!
|
const parent = context.parent!
|
||||||
const siblings = parent.node.children
|
const siblings = parent.node.children
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue