Browse Source

优化代码

es6
guy 3 years ago
parent
commit
b71cae0184
  1. 8
      src/base/single/button/button.node.js

8
src/base/single/button/button.node.js

@ -9,14 +9,16 @@
BI.NodeButton = BI.inherit(BI.BasicButton, { BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node", _baseCls: (conf._baseCls || "") + " bi-node",
open: false open: false
}); });
}, },
_initRef: function () { _initRef: function () {
if (this.isOpened()) {
this.setOpened(this.isOpened()); this.setOpened(this.isOpened());
}
BI.NodeButton.superclass._initRef.apply(this, arguments); BI.NodeButton.superclass._initRef.apply(this, arguments);
}, },
@ -38,14 +40,14 @@ BI.NodeButton = BI.inherit(BI.BasicButton, {
}, },
triggerCollapse: function () { triggerCollapse: function () {
if(this.isOpened()) { if (this.isOpened()) {
this.setOpened(false); this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
} }
}, },
triggerExpand: function () { triggerExpand: function () {
if(!this.isOpened()) { if (!this.isOpened()) {
this.setOpened(true); this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
} }

Loading…
Cancel
Save