From 9dd0602fcce2517603a572f0453ac05257802ead Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 16 Oct 2022 01:48:39 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E6=94=AF=E6=8C=81ref=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E4=BC=A0=E4=B8=AA=E5=AF=B9=E8=B1=A1=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E7=94=A8=E4=BC=A0=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/3.ob.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/3.ob.js b/src/core/3.ob.js index 9cf8fd3f9..a9019c3a8 100644 --- a/src/core/3.ob.js +++ b/src/core/3.ob.js @@ -79,23 +79,25 @@ // 获得一个当前对象的引用 _initRef: function () { - if (this.options.__ref) { - this.options.__ref.call(this, this); + var o = this.options; + if (o.__ref) { + BI.isFunction(o.__ref) ? o.__ref.call(this, this) : o.__ref.current = this; } - if (this.options.ref) { - this.options.ref.call(this, this); + if (o.ref) { + BI.isFunction(o.ref) ? o.ref.call(this, this) : o.ref.current = this; } }, //释放当前对象 _purgeRef: function () { - if (this.options.__ref) { - this.options.__ref.call(null, null); - this.options.__ref = null; + var o = this.options; + if (o.__ref) { + BI.isFunction(o.__ref) ? o.__ref.call(null, null) : o.__ref.current = null; + o.__ref = null; } - if (this.options.ref) { - this.options.ref.call(null, null); - this.options.ref = null; + if (o.ref) { + BI.isFunction(o.ref) ? o.ref.call(null, null) : o.ref.current = null; + o.ref = null; } },