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. 2
      src/base/combination/navigation.js
  3. 2
      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. 1
      src/case/colorchooser/colorchooser.popup.hex.js
  9. 1
      src/case/colorchooser/colorchooser.popup.js
  10. 5
      src/case/colorchooser/farbtastic/farbtastic.js
  11. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  12. 1
      src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js
  13. 6
      src/core/widget.js
  14. 3
      src/widget/datepane/datepane.js
  15. 2
      src/widget/datetimepane/datetimepane.js
  16. 2
      src/widget/dynamicdate/dynamicdate.combo.js
  17. 2
      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 () { mounted: function () {
var o = this.options; var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { if (o.scrollLeft !== 0 || o.scrollTop !== 0) {

2
src/base/combination/navigation.js

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

2
src/base/combination/tab.js

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

1
src/base/grid/grid.js

@ -63,6 +63,7 @@ BI.GridView = BI.inherit(BI.Widget, {
} }
}, },
// mounted之后绑定事件
mounted: function () { mounted: function () {
var o = this.options; var o = this.options;
if (o.scrollLeft !== 0 || o.scrollTop !== 0) { 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 () { mounted: function () {
var self = this; var o = this.options; var self = this; var o = this.options;
this.dragger.element.mousedown(function (e) { 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 () { mounted: function () {
var self = this, o = this.options; var self = this, o = this.options;
this._populate(); this._populate();

1
src/base/list/virtuallist.js

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

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

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

1
src/case/colorchooser/colorchooser.popup.js

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

5
src/case/colorchooser/farbtastic/farbtastic.js

@ -80,7 +80,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
}; };
}, },
mounted: function () { created: function () {
var o = this.options; var o = this.options;
if (BI.isKey(o.value)) { if (BI.isKey(o.value)) {
this.setValue(o.value); this.setValue(o.value);
@ -179,8 +179,6 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, {
// Saturation/Luminance gradient // Saturation/Luminance gradient
this.colorWrapper.element.css("backgroundColor", this._pack(this._HSLToRGB([this.hsl[0], 1, 0.5]))); 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) { _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)); var lum = Math.max(0, Math.min(1, -(pos.y / this.constants.SQUARE) + .5));
this._setHSL([this.hsl[0], sat, lum]); this._setHSL([this.hsl[0], sat, lum]);
} }
this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this);
}, },
doClick: function (event) { doClick: function (event) {

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; var o = this.options;
if(BI.isKey(o.value)) { if(BI.isKey(o.value)) {
this._checkError(o.value); this._checkError(o.value);

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

@ -45,6 +45,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, {
}; };
}, },
// mounted之后做check
mounted: function() { mounted: function() {
this.check(); this.check();
}, },

6
src/core/widget.js

@ -254,10 +254,10 @@
} }
this._mountChildren && this._mountChildren(); this._mountChildren && this._mountChildren();
if (layer === 0) { if (layer === 0) {
// mounted放到下一个宏任务里执行 // mounted里面会执行scrollTo之类的方法,如果放宏任务里会闪
setTimeout(function () { // setTimeout(function () {
self.__afterMount(lifeHook, predicate); self.__afterMount(lifeHook, predicate);
}, 0); // }, 0);
} }
return true; 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); this.setValue(this.options.value);
}, },
@ -141,7 +141,6 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
} }
}, },
setValue: function (v) { setValue: function (v) {
v = v || {}; v = v || {};
var type = v.type || BI.DynamicDateCombo.Static; 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); this.setValue(this.options.value);
}, },

2
src/widget/dynamicdate/dynamicdate.combo.js

@ -238,7 +238,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
}; };
}, },
mounted: function () { created: function () {
this._checkDynamicValue(this.storeValue); this._checkDynamicValue(this.storeValue);
}, },

2
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -246,7 +246,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
}; };
}, },
mounted: function () { created: function () {
this._checkDynamicValue(this.storeValue); this._checkDynamicValue(this.storeValue);
}, },

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); this._checkMonthStatus(this.selectedYear);
}, },

Loading…
Cancel
Save