Browse Source

增加beforeRender生命周期函数

es6
guy 4 years ago
parent
commit
e8575cc8e0
  1. 18
      src/core/widget.js

18
src/core/widget.js

@ -59,9 +59,11 @@
}
},
// 生命周期函数
beforeInit: null,
// 生命周期函数
beforeRender: null,
beforeCreate: null,
created: null,
@ -94,14 +96,24 @@
},
_initRender: function () {
var self = this;
function render () {
if (self.options.beforeRender || self.beforeRender) {
(self.options.beforeRender || self.beforeRender).call(this, BI.bind(self._render, this));
} else {
self._render();
}
}
if (this.options.beforeInit || this.beforeInit) {
this.__asking = true;
(this.options.beforeInit || this.beforeInit).call(this, BI.bind(this._render, this));
(this.options.beforeInit || this.beforeInit).call(this, render);
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
render();
}
},

Loading…
Cancel
Save