mirror of https://github.com/vuejs/core.git
fix(compiler-ssr): don't render v-if comments in TransitionGroup + static tag (#11515)
close #11514
This commit is contained in:
parent
79602f9ecd
commit
275354caba
|
@ -38,6 +38,28 @@ describe('transition-group', () => {
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #11514
|
||||||
|
test('with static tag + comment', () => {
|
||||||
|
expect(
|
||||||
|
compile(
|
||||||
|
`<transition-group tag="ul"><div v-for="i in list"/><div v-if="false"></div></transition-group>`,
|
||||||
|
).code,
|
||||||
|
).toMatchInlineSnapshot(`
|
||||||
|
"const { ssrRenderAttrs: _ssrRenderAttrs, ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
|
||||||
|
|
||||||
|
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
||||||
|
_push(\`<ul\${_ssrRenderAttrs(_attrs)}>\`)
|
||||||
|
_ssrRenderList(_ctx.list, (i) => {
|
||||||
|
_push(\`<div></div>\`)
|
||||||
|
})
|
||||||
|
if (false) {
|
||||||
|
_push(\`<div></div>\`)
|
||||||
|
}
|
||||||
|
_push(\`</ul>\`)
|
||||||
|
}"
|
||||||
|
`)
|
||||||
|
})
|
||||||
|
|
||||||
test('with dynamic tag', () => {
|
test('with dynamic tag', () => {
|
||||||
expect(
|
expect(
|
||||||
compile(
|
compile(
|
||||||
|
|
|
@ -108,7 +108,7 @@ export function ssrProcessTransitionGroup(
|
||||||
context.pushStringPart(` ${scopeId}`)
|
context.pushStringPart(` ${scopeId}`)
|
||||||
}
|
}
|
||||||
context.pushStringPart(`>`)
|
context.pushStringPart(`>`)
|
||||||
processChildren(node, context, false, true)
|
processChildren(node, context, false, true, true)
|
||||||
context.pushStringPart(`</${tag.value!.content}>`)
|
context.pushStringPart(`</${tag.value!.content}>`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue