diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index ca4511282a..3cb3b67215 100644 --- a/src/base/collection/collection.js +++ b/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) { diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js index 4419e0f3ac..11b2e092df 100644 --- a/src/base/combination/navigation.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.navigation", BI.Navigation); diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index cd8a0b6579..637ee95f32 100644 --- a/src/base/combination/tab.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.tab", BI.Tab); diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 4c682ce3bc..b0a331a7f0 100644 --- a/src/base/grid/grid.js +++ b/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) { diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index a0cf234dd5..28fd6d5be7 100644 --- a/src/base/layer/layer.popover.js +++ b/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) { diff --git a/src/base/list/listview.js b/src/base/list/listview.js index e85bfb8858..2708e4823c 100644 --- a/src/base/list/listview.js +++ b/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(); diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js index 905c06ca55..28f2d54d3a 100644 --- a/src/base/list/virtuallist.js +++ b/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(); diff --git a/src/case/colorchooser/colorchooser.popup.hex.js b/src/case/colorchooser/colorchooser.popup.hex.js index 91175357b4..9ecaba4086 100644 --- a/src/case/colorchooser/colorchooser.popup.hex.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup); diff --git a/src/case/colorchooser/colorchooser.popup.js b/src/case/colorchooser/colorchooser.popup.js index 52f0af0388..c73fd91fc2 100644 --- a/src/case/colorchooser/colorchooser.popup.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup); diff --git a/src/case/colorchooser/farbtastic/farbtastic.js b/src/case/colorchooser/farbtastic/farbtastic.js index cba596bc5f..58eb563ca8 100644 --- a/src/case/colorchooser/farbtastic/farbtastic.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.farbtastic", BI.Farbtastic); diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index aa4402ff5d..b63e607e2e 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/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); diff --git a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js index c1b3d224a4..0118cf84f0 100644 --- a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js +++ b/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); \ No newline at end of file +BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup); diff --git a/src/core/widget.js b/src/core/widget.js index ad8ac20e20..a7017c403f 100644 --- a/src/core/widget.js +++ b/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; }, diff --git a/src/widget/datepane/datepane.js b/src/widget/datepane/datepane.js index f470de0d93..d1178e91d3 100644 --- a/src/widget/datepane/datepane.js +++ b/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; diff --git a/src/widget/datetimepane/datetimepane.js b/src/widget/datetimepane/datetimepane.js index 61f3be8acf..d80617671f 100644 --- a/src/widget/datetimepane/datetimepane.js +++ b/src/widget/datetimepane/datetimepane.js @@ -109,7 +109,7 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, { }; }, - mounted: function () { + created: function () { this.setValue(this.options.value); }, diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index 8fedf82728..774e41712f 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/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 -}); \ No newline at end of file +}); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 13519a5d32..7764b2b968 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/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 -}); \ No newline at end of file +}); diff --git a/src/widget/yearmonth/card.static.yearmonth.js b/src/widget/yearmonth/card.static.yearmonth.js index 26e8c29ded..9e905d9ee4 100644 --- a/src/widget/yearmonth/card.static.yearmonth.js +++ b/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); },