"const { ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
return function ssrRender(_ctx, _push, _parent, _attrs) {
+ if (_attrs.tag) {
+ _push(\`<\${_attrs.tag}>\`)
+ }
_push(\`<!--[-->\`)
_ssrRenderList(_ctx.list, (i) => {
_push(\`<div></div>\`)
})
_push(\`<!--]-->\`)
+ if (_attrs.tag) {
+ _push(\`</\${_attrs.tag}>\`)
+ }
}"
`)
})
"const { ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
return function ssrRender(_ctx, _push, _parent, _attrs) {
+ if (_attrs.tag) {
+ _push(\`<\${_attrs.tag}>\`)
+ }
_push(\`<!--[-->\`)
_ssrRenderList(10, (i) => {
_push(\`<div></div>\`)
_push(\`<div>ok</div>\`)
}
_push(\`<!--]-->\`)
+ if (_attrs.tag) {
+ _push(\`</\${_attrs.tag}>\`)
+ }
}"
`)
})
NodeTypes,
type TransformContext,
buildProps,
+ createBlockStatement,
createCallExpression,
+ createIfStatement,
+ createSimpleExpression,
findProp,
} from '@vue/compiler-dom'
import { SSR_RENDER_ATTRS } from '../runtimeHelpers'
context.pushStringPart(`</${tag.value!.content}>`)
}
} else {
+ // #12827 _attrs fallthrough may contain tag property
+ const hasFallthroughAttrs = node.props.some(
+ p =>
+ p.type === NodeTypes.DIRECTIVE &&
+ p.name === 'bind' &&
+ p.exp &&
+ p.exp.type === NodeTypes.SIMPLE_EXPRESSION &&
+ p.exp.content === '_attrs',
+ )
+ if (hasFallthroughAttrs) {
+ context.pushStatement(
+ createIfStatement(
+ createSimpleExpression('_attrs.tag'),
+ createBlockStatement([
+ createSimpleExpression('_push(`<${_attrs.tag}>`)'),
+ ]),
+ ),
+ )
+ }
// fragment
processChildren(node, context, true, true, true)
+
+ if (hasFallthroughAttrs) {
+ context.pushStatement(
+ createIfStatement(
+ createSimpleExpression('_attrs.tag'),
+ createBlockStatement([
+ createSimpleExpression('_push(`</${_attrs.tag}>`)'),
+ ]),
+ ),
+ )
+ }
}
}