feat(compiler): convert text mixed with elements into createVNode calls
This ensures they are tracked as dynamic children when inside blocks. Also guaruntees compiled vnodes always have vnode children in arrays so that they can skip normalizeVNode safely in optimized mode.
This commit is contained in:
@@ -35,6 +35,7 @@ export const enum NodeTypes {
|
||||
IF,
|
||||
IF_BRANCH,
|
||||
FOR,
|
||||
TEXT_CALL,
|
||||
// codegen
|
||||
JS_CALL_EXPRESSION,
|
||||
JS_OBJECT_EXPRESSION,
|
||||
@@ -86,6 +87,7 @@ export type TemplateChildNode =
|
||||
| CommentNode
|
||||
| IfNode
|
||||
| ForNode
|
||||
| TextCallNode
|
||||
|
||||
export interface RootNode extends Node {
|
||||
type: NodeTypes.ROOT
|
||||
@@ -227,6 +229,12 @@ export interface ForNode extends Node {
|
||||
codegenNode: ForCodegenNode
|
||||
}
|
||||
|
||||
export interface TextCallNode extends Node {
|
||||
type: NodeTypes.TEXT_CALL
|
||||
content: TextNode | InterpolationNode | CompoundExpressionNode
|
||||
codegenNode: CallExpression
|
||||
}
|
||||
|
||||
// We also include a number of JavaScript AST nodes for code generation.
|
||||
// The AST is an intentionally minimal subset just to meet the exact needs of
|
||||
// Vue render function generation.
|
||||
|
||||
Reference in New Issue
Block a user