From 1a0f5681b67f0249e989d9ae53ebb2e21f25537e Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 25 Nov 2021 17:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20watch?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/fix/fix.compact.js | 14 ++++---------- src/core/4.widget.js | 5 +++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index 69a0a3196..a2df708a6 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -146,18 +146,12 @@ needPop && popTarget(); }; - var _render = BI.Widget.prototype._render; - BI.Widget.prototype._render = function () { - var needPop = false; - if (_global.Fix && this._store) { - needPop = true; - pushTarget(this.store); - } - _render.apply(this, arguments); + var __initWatch = BI.Widget.prototype.__initWatch; + BI.Widget.prototype.__initWatch = function () { + __initWatch.apply(this, arguments); if (_global.Fix && this._store) { initWatch(this, this.watch); } - needPop && popTarget(); }; var unMount = BI.Widget.prototype.__d; @@ -183,7 +177,7 @@ delete this.__cacheStore; }; - _.each(["__afterRender", "_mount", "__afterMount"], function (name) { + _.each(["_render", "__afterRender", "_mount", "__afterMount"], function (name) { var old = BI.Widget.prototype[name]; old && (BI.Widget.prototype[name] = function () { this.store && pushTarget(this.store); diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 90ea28ad8..c104a03c5 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -319,6 +319,10 @@ this._isMounted = false; }, + __initWatch: function () { + // initWatch拦截的方法 + }, + _initElement: function () { var self = this; this.__isMounting = true; @@ -328,6 +332,7 @@ if (BI.isPlainObject(els)) { els = [els]; } + this.__initWatch(); if (BI.isArray(els)) { BI.each(els, function (i, el) { if (el) {