Browse Source

Pull request #1810: 无JIRA任务 优化一些mounted的写法

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'e39fcb3bec5e97f205c581e5c0c641208f9280b3':
  update
  update
es6
guy 4 years ago
parent
commit
7df82293d3
  1. 1
      src/base/collection/collection.js
  2. 4
      src/base/combination/navigation.js
  3. 4
      src/base/combination/tab.js
  4. 1
      src/base/grid/grid.js
  5. 1
      src/base/layer/layer.popover.js
  6. 1
      src/base/list/listview.js
  7. 1
      src/base/list/virtuallist.js
  8. 3
      src/case/colorchooser/colorchooser.popup.hex.js
  9. 3
      src/case/colorchooser/colorchooser.popup.js
  10. 7
      src/case/colorchooser/farbtastic/farbtastic.js
  11. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  12. 3
      src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
  13. 8
      src/core/widget.js
  14. 3
      src/widget/datepane/datepane.js
  15. 2
      src/widget/datetimepane/datetimepane.js
  16. 4
      src/widget/dynamicdate/dynamicdate.combo.js
  17. 4
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  18. 2
      src/widget/yearmonth/card.static.yearmonth.js

1
src/base/collection/collection.js

@ -61,6 +61,7 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
},
// mounted之后绑定事件
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) {

4
src/base/combination/navigation.js

@ -52,7 +52,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
});
},
mounted: function () {
created: function () {
var o = this.options;
if (o.showIndex !== false) {
this.setSelect(o.showIndex);
@ -159,4 +159,4 @@ BI.Navigation = BI.inherit(BI.Widget, {
});
BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.navigation", BI.Navigation);
BI.shortcut("bi.navigation", BI.Navigation);

4
src/base/combination/tab.js

@ -76,7 +76,7 @@ BI.Tab = BI.inherit(BI.Widget, {
}
},
mounted: function () {
created: function () {
var o = this.options;
if (o.showIndex !== false) {
this.setSelect(o.showIndex);
@ -150,4 +150,4 @@ BI.Tab = BI.inherit(BI.Widget, {
});
BI.Tab.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.tab", BI.Tab);
BI.shortcut("bi.tab", BI.Tab);

1
src/base/grid/grid.js

@ -63,6 +63,7 @@ BI.GridView = BI.inherit(BI.Widget, {
}
},
// mounted之后绑定事件
mounted: function () {
var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) {

1
src/base/layer/layer.popover.js

@ -152,6 +152,7 @@ BI.Popover = BI.inherit(BI.Widget, {
});
},
// mounted之后绑定事件
mounted: function () {
var self = this; var o = this.options;
this.dragger.element.mousedown(function (e) {

1
src/base/list/listview.js

@ -38,6 +38,7 @@ BI.ListView = BI.inherit(BI.Widget, {
};
},
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
this._populate();

1
src/base/list/virtuallist.js

@ -47,6 +47,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
};
},
// mounted之后绑定事件
mounted: function () {
var self = this, o = this.options;
this._populate();

3
src/case/colorchooser/colorchooser.popup.hex.js

@ -177,6 +177,7 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
};
},
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () {
var self = this;
var o = this.options;
@ -249,4 +250,4 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, {
});
BI.HexColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.HexColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup);
BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup);

3
src/case/colorchooser/colorchooser.popup.js

@ -161,6 +161,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
};
},
// 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示
mounted: function () {
var self = this;
var o = this.options;
@ -233,4 +234,4 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, {
});
BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.ColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);
BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);

7
src/case/colorchooser/farbtastic/farbtastic.js

@ -80,7 +80,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
};
},
mounted: function () {
created: function () {
var o = this.options;
if (BI.isKey(o.value)) {
this.setValue(o.value);
@ -179,8 +179,6 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
// Saturation/Luminance gradient
this.colorWrapper.element.css("backgroundColor", this._pack(this._HSLToRGB([this.hsl[0], 1, 0.5])));
this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this);
},
_absolutePosition: function (el) {
@ -257,6 +255,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
var lum = Math.max(0, Math.min(1, -(pos.y / this.constants.SQUARE) + .5));
this._setHSL([this.hsl[0], sat, lum]);
}
this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this);
},
doClick: function (event) {
@ -277,4 +276,4 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
}
});
BI.Farbtastic.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.farbtastic", BI.Farbtastic);
BI.shortcut("bi.farbtastic", BI.Farbtastic);

2
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -115,7 +115,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
};
},
mounted: function () {
created: function () {
var o = this.options;
if(BI.isKey(o.value)) {
this._checkError(o.value);

3
src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js

@ -45,6 +45,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
};
},
// mounted之后做check
mounted: function() {
this.check();
},
@ -69,4 +70,4 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
});
BI.SearchTextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup);
BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup);

8
src/core/widget.js

@ -254,10 +254,10 @@
}
this._mountChildren && this._mountChildren();
if (layer === 0) {
// mounted放到下一个宏任务里执行
setTimeout(function () {
self.__afterMount(lifeHook, predicate);
}, 0);
// mounted里面会执行scrollTo之类的方法,如果放宏任务里会闪
// setTimeout(function () {
self.__afterMount(lifeHook, predicate);
// }, 0);
}
return true;
},

3
src/widget/datepane/datepane.js

@ -109,7 +109,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
};
},
mounted: function () {
created: function () {
this.setValue(this.options.value);
},
@ -141,7 +141,6 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
}
},
setValue: function (v) {
v = v || {};
var type = v.type || BI.DynamicDateCombo.Static;

2
src/widget/datetimepane/datetimepane.js

@ -109,7 +109,7 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, {
};
},
mounted: function () {
created: function () {
this.setValue(this.options.value);
},

4
src/widget/dynamicdate/dynamicdate.combo.js

@ -238,7 +238,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
};
},
mounted: function () {
created: function () {
this._checkDynamicValue(this.storeValue);
},
@ -321,4 +321,4 @@ BI.shortcut("bi.dynamic_date_combo", BI.DynamicDateCombo);
BI.extend(BI.DynamicDateCombo, {
Static: 1,
Dynamic: 2
});
});

4
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -246,7 +246,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
};
},
mounted: function () {
created: function () {
this._checkDynamicValue(this.storeValue);
},
@ -329,4 +329,4 @@ BI.shortcut("bi.dynamic_date_time_combo", BI.DynamicDateTimeCombo);
BI.extend(BI.DynamicDateTimeCombo, {
Static: 1,
Dynamic: 2
});
});

2
src/widget/yearmonth/card.static.yearmonth.js

@ -98,7 +98,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
};
},
mounted: function() {
created: function() {
this._checkMonthStatus(this.selectedYear);
},

Loading…
Cancel
Save