fix: generate v-if fallback comment as block
This commit is contained in:
@@ -389,7 +389,7 @@ return function render() {
|
||||
? _createBlock(\\"div\\", _hoisted_1, [
|
||||
_hoisted_2
|
||||
])
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
]))
|
||||
}
|
||||
}"
|
||||
|
||||
@@ -161,7 +161,7 @@ return function render() {
|
||||
? _createBlock(_Fragment, { key: 0 }, _renderList(list, (i) => {
|
||||
return (_openBlock(), _createBlock(\\"div\\"))
|
||||
}), 128 /* UNKEYED_FRAGMENT */)
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -9,7 +9,7 @@ return function render() {
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -27,7 +27,7 @@ return function render() {
|
||||
\\"hello\\",
|
||||
_createVNode(\\"p\\")
|
||||
])
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -41,7 +41,7 @@ return function render() {
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -87,7 +87,7 @@ return function render() {
|
||||
? _createBlock(\\"div\\", { key: 0 })
|
||||
: orNot
|
||||
? _createBlock(\\"p\\", { key: 1 })
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -101,7 +101,7 @@ return function render() {
|
||||
|
||||
return (_openBlock(), ok
|
||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
||||
: _createCommentVNode())
|
||||
: _createCommentVNode(\\"v-if\\", true))
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
@@ -152,7 +152,12 @@ function createCodegenNodeForBranch(
|
||||
return createConditionalExpression(
|
||||
branch.condition,
|
||||
createChildrenCodegenNode(branch, index, context),
|
||||
createCallExpression(context.helper(CREATE_COMMENT))
|
||||
// make sure to pass in asBlock: true so that the comment node call
|
||||
// closes the current block.
|
||||
createCallExpression(context.helper(CREATE_COMMENT), [
|
||||
__DEV__ ? '"v-if"' : '""',
|
||||
'true'
|
||||
])
|
||||
) as IfConditionalExpression
|
||||
} else {
|
||||
return createChildrenCodegenNode(branch, index, context) as BlockCodegenNode
|
||||
|
||||
Reference in New Issue
Block a user