From 56fe1b8c70979fe3ac5e94535f8b68aa021afae5 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 22 Oct 2021 20:06:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/4.widget.js | 52 +++++--------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/src/core/4.widget.js b/src/core/4.widget.js index f9f18c253..b946b3df6 100644 --- a/src/core/4.widget.js +++ b/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,9 +150,13 @@ __afterRender: function () { pushTarget(this); - this.__async === true && this._isMounted && callLifeHook(this, "beforeMount"); + var async = this.__async; + this.__async = false; + if(async && this._isMounted){ + callLifeHook(this, "beforeMount"); + } this._mount(); - if (this.__async === true && this._isMounted) { + if (async && this._isMounted) { callLifeHook(this, "mounted"); this.fireEvent(BI.Events.MOUNT); } @@ -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; },