mirror of https://github.com/vuejs/core.git
parent
cde7f05787
commit
1ff407676f
|
@ -25,7 +25,7 @@ describe('ssr: element', () => {
|
||||||
test('v-html', () => {
|
test('v-html', () => {
|
||||||
expect(getCompiledString(`<div v-html="foo"/>`)).toMatchInlineSnapshot(`
|
expect(getCompiledString(`<div v-html="foo"/>`)).toMatchInlineSnapshot(`
|
||||||
"\`<div>\${
|
"\`<div>\${
|
||||||
_ctx.foo
|
(_ctx.foo) ?? ''
|
||||||
}</div>\`"
|
}</div>\`"
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
|
@ -22,6 +22,7 @@ import {
|
||||||
createAssignmentExpression,
|
createAssignmentExpression,
|
||||||
createCallExpression,
|
createCallExpression,
|
||||||
createCompilerError,
|
createCompilerError,
|
||||||
|
createCompoundExpression,
|
||||||
createConditionalExpression,
|
createConditionalExpression,
|
||||||
createInterpolation,
|
createInterpolation,
|
||||||
createSequenceExpression,
|
createSequenceExpression,
|
||||||
|
@ -188,7 +189,10 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
|
||||||
// special cases with children override
|
// special cases with children override
|
||||||
if (prop.type === NodeTypes.DIRECTIVE) {
|
if (prop.type === NodeTypes.DIRECTIVE) {
|
||||||
if (prop.name === 'html' && prop.exp) {
|
if (prop.name === 'html' && prop.exp) {
|
||||||
rawChildrenMap.set(node, prop.exp)
|
rawChildrenMap.set(
|
||||||
|
node,
|
||||||
|
createCompoundExpression([`(`, prop.exp, `) ?? ''`]),
|
||||||
|
)
|
||||||
} else if (prop.name === 'text' && prop.exp) {
|
} else if (prop.name === 'text' && prop.exp) {
|
||||||
node.children = [createInterpolation(prop.exp, prop.loc)]
|
node.children = [createInterpolation(prop.exp, prop.loc)]
|
||||||
} else if (prop.name === 'slot') {
|
} else if (prop.name === 'slot') {
|
||||||
|
|
Loading…
Reference in New Issue