Browse Source

checkbox getvalue 返回1/0

liuzhuang 3 years ago
parent
commit
102d57147d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/controls/input/checkbox.js

+ 8 - 1
src/controls/input/checkbox.js

@@ -15,7 +15,7 @@ import {PropertyDescription} from "../../PropertyDescription";
 export default function () {
 
     const cc = Ext.form.field.Checkbox.prototype.constructor
-    const {initComponent} = Ext.form.field.Checkbox.prototype
+    const {initComponent, getValue} = Ext.form.field.Checkbox.prototype
     Ext.form.field.Checkbox.override({
         constructor(config) {
             const newConfig = _.defaultsDeep({
@@ -26,6 +26,13 @@ export default function () {
             cc.call(this, newConfig)
         },
 
+        getValue() {
+            const ov = getValue.call(this)
+            const nv = ov ? 1 : 0
+            // console.log('cc:', nv, ov)
+            return nv
+        },
+
         initComponent() {
             initComponent.call(this)
         },