Browse Source

KERNEL-12098 feat: radio和checkbox item代码规范化

fineui中的代码是可以作为其他同学开发自定义组件的参考的. 所以一定要保持规范优雅
es6
zsmj 2 years ago
parent
commit
6e3f5865fb
  1. 6
      src/case/button/item.multiselect.js
  2. 11
      src/case/button/item.singleselect.radio.js

6
src/case/button/item.multiselect.js

@ -20,11 +20,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
this.checkbox = BI.createWidget({
type: "bi.checkbox"
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
});
return {
type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"],
@ -74,7 +69,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
doClick: function () {
BI.MultiSelectItem.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected());
if (this.isValid()) {
this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this);
}

11
src/case/button/item.singleselect.radio.js

@ -28,16 +28,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
ref: function (_ref) {
self.radio = _ref;
},
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
}
}
],
}]
}, {
el: {
@ -82,7 +72,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
doClick: function () {
BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
if (this.isValid()) {
this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
}

Loading…
Cancel
Save