Просмотр исходного кода

chore(compiler-ssr): move `defaultProps` initialization into `input` tag branch (#14115)

Vida Xie 5 месяцев назад
Родитель
Сommit
83f6ab686d
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      packages/compiler-ssr/src/transforms/ssrVModel.ts

+ 4 - 4
packages/compiler-ssr/src/transforms/ssrVModel.ts

@@ -83,11 +83,11 @@ export const ssrTransformModel: DirectiveTransform = (dir, node, context) => {
 
   if (node.tagType === ElementTypes.ELEMENT) {
     const res: DirectiveTransformResult = { props: [] }
-    const defaultProps = [
-      // default value binding for text type inputs
-      createObjectProperty(`value`, model),
-    ]
     if (node.tag === 'input') {
+      const defaultProps = [
+        // default value binding for text type inputs
+        createObjectProperty(`value`, model),
+      ]
       const type = findProp(node, 'type')
       if (type) {
         const value = findValueBinding(node)