Browse Source

Pull request #2089: 无JIRA任务 整理代码

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

* commit '553e6d715985ed302a87e5122440c2d6e97746e2':
  整理代码
es6
guy 3 years ago
parent
commit
e2a34a74ee
  1. 27
      src/core/4.widget.js

27
src/core/4.widget.js

@ -104,11 +104,28 @@
_initRender: function () {
var self = this;
function render () {
var initCallbackCalled = false;
var renderCallbackCalled = false;
function init () {
// 加个保险
if (initCallbackCalled === true) {
_global.console && console.error("组件: 请检查beforeInit内部的写法,callback只能执行一次");
return;
}
initCallbackCalled = true;
function render () {
// 加个保险
if (renderCallbackCalled === true) {
_global.console && console.error("组件: 请检查beforeRender内部的写法,callback只能执行一次");
return;
}
renderCallbackCalled = true;
self._render();
}
if (self.options.beforeRender || self.beforeRender) {
self.__async = true;
(self.options.beforeRender || self.beforeRender).call(self, BI.bind(self._render, self));
(self.options.beforeRender || self.beforeRender).call(self, render);
} else {
self._render();
}
@ -116,9 +133,9 @@
if (this.options.beforeInit || this.beforeInit) {
this.__asking = true;
(this.options.beforeInit || this.beforeInit).call(this, render);
(this.options.beforeInit || this.beforeInit).call(this, init);
} else {
render();
init();
}
},

Loading…
Cancel
Save