fix(compiler-ssr): fix input w/ v-bind="obj" codegen
This commit is contained in:
@@ -118,7 +118,7 @@ describe('ssr: v-model', () => {
|
||||
return function ssrRender(_ctx, _push, _parent) {
|
||||
let _temp0
|
||||
|
||||
_push(\`<input\${_ssrRenderAttrs(_temp0 = _ctx.obj, _mergeProps(_temp0, _ssrGetDynamicModelProps(_temp0, _ctx.foo)))}>\`)
|
||||
_push(\`<input\${_ssrRenderAttrs((_temp0 = _ctx.obj, _mergeProps(_temp0, _ssrGetDynamicModelProps(_temp0, _ctx.foo))))}>\`)
|
||||
}"
|
||||
`)
|
||||
|
||||
@@ -130,7 +130,7 @@ describe('ssr: v-model', () => {
|
||||
return function ssrRender(_ctx, _push, _parent) {
|
||||
let _temp0
|
||||
|
||||
_push(\`<input\${_ssrRenderAttrs(_temp0 = _mergeProps({ id: \\"x\\" }, _ctx.obj, { class: \\"y\\" }), _mergeProps(_temp0, _ssrGetDynamicModelProps(_temp0, _ctx.foo)))}>\`)
|
||||
_push(\`<input\${_ssrRenderAttrs((_temp0 = _mergeProps({ id: \\"x\\" }, _ctx.obj, { class: \\"y\\" }), _mergeProps(_temp0, _ssrGetDynamicModelProps(_temp0, _ctx.foo))))}>\`)
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
@@ -22,7 +22,8 @@ import {
|
||||
TextNode,
|
||||
hasDynamicKeyVBind,
|
||||
MERGE_PROPS,
|
||||
isBindKey
|
||||
isBindKey,
|
||||
createSequenceExpression
|
||||
} from '@vue/compiler-dom'
|
||||
import {
|
||||
escapeHtml,
|
||||
@@ -107,16 +108,18 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
|
||||
const tempId = `_temp${context.temps++}`
|
||||
const tempExp = createSimpleExpression(tempId, false)
|
||||
propsExp.arguments = [
|
||||
createAssignmentExpression(tempExp, props),
|
||||
createCallExpression(context.helper(MERGE_PROPS), [
|
||||
tempExp,
|
||||
createCallExpression(
|
||||
context.helper(SSR_GET_DYNAMIC_MODEL_PROPS),
|
||||
[
|
||||
tempExp, // existing props
|
||||
vModel.exp! // model
|
||||
]
|
||||
)
|
||||
createSequenceExpression([
|
||||
createAssignmentExpression(tempExp, props),
|
||||
createCallExpression(context.helper(MERGE_PROPS), [
|
||||
tempExp,
|
||||
createCallExpression(
|
||||
context.helper(SSR_GET_DYNAMIC_MODEL_PROPS),
|
||||
[
|
||||
tempExp, // existing props
|
||||
vModel.exp! // model
|
||||
]
|
||||
)
|
||||
])
|
||||
])
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user