From 8d68ba157fef7ec842a2d362a069bb9f5e02b21f Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 19 May 2017 11:26:37 +0800 Subject: [PATCH] =?UTF-8?q?button=E7=9A=84doClick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 21 ++++++++++++++------- docs/base.js | 21 ++++++++++++++------- src/base/single/button/button.basic.js | 21 ++++++++++++++------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/bi/base.js b/bi/base.js index 005c9fea9..1035905ee 100644 --- a/bi/base.js +++ b/bi/base.js @@ -781,7 +781,7 @@ BI.BasicButton = BI.inherit(BI.Single, { }); //之后的300ms点击无效 - var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); + var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); function ev(e) { if (o.stopEvent) { @@ -803,6 +803,11 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if (!this.isDisableSelected()) { + this.isForceSelected() ? this.setSelected(true) : + (this.isForceNotSelected() ? this.setSelected(false) : + this.setSelected(!this.isSelected())); + } if (this.isValid()) { o.handler.call(this, this.getValue(), this); var v = this.getValue(); @@ -811,13 +816,15 @@ BI.BasicButton = BI.inherit(BI.Single, { } }, - doClick: function () { - if (!this.isDisableSelected()) { - this.isForceSelected() ? this.setSelected(true) : - (this.isForceNotSelected() ? this.setSelected(false) : - this.setSelected(!this.isSelected())); - } + _doClick: function () { this._trigger(); + if (this.isValid()) { + this.doClick(); + } + }, + + doClick: function () { + }, handle: function () { diff --git a/docs/base.js b/docs/base.js index 005c9fea9..1035905ee 100644 --- a/docs/base.js +++ b/docs/base.js @@ -781,7 +781,7 @@ BI.BasicButton = BI.inherit(BI.Single, { }); //之后的300ms点击无效 - var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); + var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); function ev(e) { if (o.stopEvent) { @@ -803,6 +803,11 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if (!this.isDisableSelected()) { + this.isForceSelected() ? this.setSelected(true) : + (this.isForceNotSelected() ? this.setSelected(false) : + this.setSelected(!this.isSelected())); + } if (this.isValid()) { o.handler.call(this, this.getValue(), this); var v = this.getValue(); @@ -811,13 +816,15 @@ BI.BasicButton = BI.inherit(BI.Single, { } }, - doClick: function () { - if (!this.isDisableSelected()) { - this.isForceSelected() ? this.setSelected(true) : - (this.isForceNotSelected() ? this.setSelected(false) : - this.setSelected(!this.isSelected())); - } + _doClick: function () { this._trigger(); + if (this.isValid()) { + this.doClick(); + } + }, + + doClick: function () { + }, handle: function () { diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 80b513862..8e1079af0 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -198,7 +198,7 @@ BI.BasicButton = BI.inherit(BI.Single, { }); //之后的300ms点击无效 - var onClick = BI.debounce(this.doClick, BI.EVENT_RESPONSE_TIME, true); + var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); function ev(e) { if (o.stopEvent) { @@ -220,6 +220,11 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if (!this.isDisableSelected()) { + this.isForceSelected() ? this.setSelected(true) : + (this.isForceNotSelected() ? this.setSelected(false) : + this.setSelected(!this.isSelected())); + } if (this.isValid()) { o.handler.call(this, this.getValue(), this); var v = this.getValue(); @@ -228,13 +233,15 @@ BI.BasicButton = BI.inherit(BI.Single, { } }, - doClick: function () { - if (!this.isDisableSelected()) { - this.isForceSelected() ? this.setSelected(true) : - (this.isForceNotSelected() ? this.setSelected(false) : - this.setSelected(!this.isSelected())); - } + _doClick: function () { this._trigger(); + if (this.isValid()) { + this.doClick(); + } + }, + + doClick: function () { + }, handle: function () {