Browse Source

Pull request #2235: KERNEL-9443 fix: 修改下initwatch顺序 同步的hook

Merge in VISUAL/fineui from ~IMP/fineui_fui:master to master

* commit 'd5d3f9f1fdefd05d8d49c4d900ff1282e25f2949':
  KERNEL-9443 fix: 同步fix.compact
  无jira任务 同步hook
es6
imp 3 years ago
parent
commit
c8da44af2f
  1. 4
      dist/fix/fix.compact.ie.js
  2. 9
      dist/fix/fix.compact.js
  3. 12
      src/core/4.widget.js

4
dist/fix/fix.compact.ie.js vendored

@ -157,9 +157,11 @@
if (_global.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch);
} }
_render.apply(this, arguments); _render.apply(this, arguments);
if (_global.Fix && this._store) {
initWatch(this, this.watch);
}
needPop && popTarget(); needPop && popTarget();
}; };

9
dist/fix/fix.compact.js vendored

@ -152,14 +152,11 @@
if (_global.Fix && this._store) { if (_global.Fix && this._store) {
needPop = true; needPop = true;
pushTarget(this.store); pushTarget(this.store);
initWatch(this, this.watch);
} }
_render.apply(this, arguments); _render.apply(this, arguments);
// try { if (_global.Fix && this._store) {
// _render.apply(this, arguments); initWatch(this, this.watch);
// } catch (e) { }
// console.error(e);
// }
needPop && popTarget(); needPop && popTarget();
}; };

12
src/core/4.widget.js

@ -148,10 +148,12 @@
_render: function () { _render: function () {
this.__asking = false; this.__asking = false;
pushTarget(this);
callLifeHook(this, "beforeCreate"); callLifeHook(this, "beforeCreate");
this._initElement(); this._initElement();
this._initEffects(); this._initEffects();
callLifeHook(this, "created"); callLifeHook(this, "created");
popTarget();
this.__async = false; this.__async = false;
}, },
@ -299,6 +301,7 @@
var self = this; var self = this;
var isMounted = this._isMounted; var isMounted = this._isMounted;
this.__async === true && isMounted && callLifeHook(this, "beforeMount"); this.__async === true && isMounted && callLifeHook(this, "beforeMount");
this.__isMounting = true;
// if (!this._initVNode()) { // if (!this._initVNode()) {
var render = BI.isFunction(this.options.render) ? this.options.render : this.render; var render = BI.isFunction(this.options.render) ? this.options.render : this.render;
var els = render && render.call(this); var els = render && render.call(this);
@ -388,6 +391,7 @@
layer = layer || 0; layer = layer || 0;
lifeHook !== false && !this.__async && callLifeHook(this, "beforeMount"); lifeHook !== false && !this.__async && callLifeHook(this, "beforeMount");
this._isMounted = true; this._isMounted = true;
this.__isMounting = false;
for (var key in this._children) { for (var key in this._children) {
var child = this._children[key]; var child = this._children[key];
!self.isEnabled() && child._setEnable(false); !self.isEnabled() && child._setEnable(false);
@ -798,6 +802,10 @@
BI.onBeforeMount = function (beforeMount) { BI.onBeforeMount = function (beforeMount) {
if (current) { if (current) {
if(current.__isMounting){
beforeMount();
return;
}
if (!current.beforeMount) { if (!current.beforeMount) {
current.beforeMount = []; current.beforeMount = [];
} else if (!BI.isArray(current.beforeMount)) { } else if (!BI.isArray(current.beforeMount)) {
@ -808,6 +816,10 @@
}; };
BI.onMounted = function (mounted) { BI.onMounted = function (mounted) {
if (current) { if (current) {
if(current._isMounted && !this.__async){
mounted();
return;
}
if (!current.mounted) { if (!current.mounted) {
current.mounted = []; current.mounted = [];
} else if (!BI.isArray(current.mounted)) { } else if (!BI.isArray(current.mounted)) {

Loading…
Cancel
Save