Browse Source

Pull request #2243: 无JIRA任务 优化逻辑

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

* commit 'f98b4c68876adcee574d29cdb6e69e2ff8d6cd35':
  优化逻辑
  优化逻辑
es6
guy 3 years ago
parent
commit
a1026c97e9
  1. 58
      src/core/4.widget.js

58
src/core/4.widget.js

@ -129,7 +129,6 @@
renderCallbackCalled = true;
self._render();
self.__afterRender();
self.__async = false;
}
if (self.options.beforeRender || self.beforeRender) {
@ -151,11 +150,15 @@
__afterRender: function () {
pushTarget(this);
this.__async === true && this._isMounted && callLifeHook(this, "beforeMount");
this._mount();
if (this.__async === true && this._isMounted) {
var async = this.__async;
this.__async = false;
if (async && this._isMounted) {
callLifeHook(this, "beforeMount");
this._mount();
callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
} else {
this._mount();
}
popTarget();
},
@ -330,49 +333,6 @@
}
},
// _initVNode: function () {
// if (this.options.vdom) {
// var div = document.createElement("div");
// var element = this.element;
// element.append(div);
// this.vnode = this._renderVNode();
// BI.patchVNode(div, this.vnode);
// // 去除这个临时的div
// BI.DOM.hang([div]);
// element.attr("style", this.vnode.elm.getAttribute("style"));
// element.addClass(this.vnode.elm.getAttribute("class"));
// element.empty();
// BI.each(BI.jQuery(this.vnode.elm).children(), function (i, node) {
// element.append(node);
// });
// return true;
// }
// return false;
// },
// _renderVNode: function () {
// var self = this;
// var render = BI.isFunction(this.options.render) ? this.options.render : this.render;
// var els = render && render.call(this);
// els = BI.Plugin.getRender(this.options.type, els);
// if (BI.isPlainObject(els)) {
// els = [els];
// }
// if (BI.isArray(els)) {
// var container = document.createElement("div");
// this._children = {};
// BI.each(els, function (i, el) {
// if (el) {
// var w = BI._lazyCreateWidget(el, {
// element: container
// });
// self.addWidget(w);
// }
// });
// }
// return BI.Element2Vnode(container);
// },
_setParent: function (parent) {
this._parent = parent;
},
@ -806,7 +766,7 @@
BI.onBeforeMount = function (beforeMount) {
if (current) {
if(current.__isMounting){
if (current.__isMounting) {
beforeMount();
return;
}
@ -820,7 +780,7 @@
};
BI.onMounted = function (mounted) {
if (current) {
if(current._isMounted && !this.__async){
if (current._isMounted && !this.__async) {
mounted();
return;
}

Loading…
Cancel
Save