Browse Source

do not use looseEqual for checkbox v-model if has no true-value binding (fix #4586)

Evan You 9 years ago
parent
commit
4d9de6a2e3
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/platforms/web/compiler/directives/model.js

+ 5 - 2
src/platforms/web/compiler/directives/model.js

@@ -56,8 +56,11 @@ function genCheckboxModel (
   const falseValueBinding = getBindingAttr(el, 'false-value') || 'false'
   addProp(el, 'checked',
     `Array.isArray(${value})` +
-      `?_i(${value},${valueBinding})>-1` +
-      `:_q(${value},${trueValueBinding})`
+      `?_i(${value},${valueBinding})>-1` + (
+        trueValueBinding === 'true'
+          ? `:(${value})`
+          : `:_q(${value},${trueValueBinding})`
+      )
   )
   addHandler(el, 'change',
     `var $$a=${value},` +