Evan You пре 8 година
родитељ
комит
96b9744811
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      src/platforms/web/compiler/modules/model.js

+ 3 - 2
src/platforms/web/compiler/modules/model.js

@@ -28,6 +28,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
     if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
       const typeBinding: any = getBindingAttr(el, 'type')
       const ifCondition = getAndRemoveAttr(el, 'v-if', true)
+      const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``
       // 1. checkbox
       const branch0 = cloneASTElement(el)
       // process for on the main node
@@ -35,7 +36,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
       addRawAttr(branch0, 'type', 'checkbox')
       processElement(branch0, options)
       branch0.processed = true // prevent it from double-processed
-      branch0.if = `type==='checkbox'` + (ifCondition ? `&&(${ifCondition})` : ``)
+      branch0.if = `type==='checkbox'` + ifConditionExtra
       addIfCondition(branch0, {
         exp: branch0.if,
         block: branch0
@@ -46,7 +47,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
       addRawAttr(branch1, 'type', 'radio')
       processElement(branch1, options)
       addIfCondition(branch0, {
-        exp: `type==='radio'` + (ifCondition ? `&&(${ifCondition})` : ``),
+        exp: `type==='radio'` + ifConditionExtra,
         block: branch1
       })
       // 3. other