fix(compiler-ssr): should not render key/ref bindings in ssr

This commit is contained in:
Evan You
2020-11-27 12:35:00 -05:00
parent a5d6f8091e
commit 5b6266284d
2 changed files with 21 additions and 3 deletions

View File

@@ -198,6 +198,9 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
if (isStaticExp(key)) {
let attrName = key.content
// static key attr
if (attrName === 'key' || attrName === 'ref') {
continue
}
if (attrName === 'class') {
openTag.push(
` class="`,
@@ -274,6 +277,9 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
if (node.tag === 'textarea' && prop.name === 'value' && prop.value) {
rawChildrenMap.set(node, escapeHtml(prop.value.content))
} else if (!hasDynamicVBind) {
if (prop.name === 'key' || prop.name === 'ref') {
continue
}
// static prop
if (prop.name === 'class' && prop.value) {
staticClassBinding = JSON.stringify(prop.value.content)