From 3d80b5999aa82f62ca83ff4368a19634d9edb9ef Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 5 Sep 2021 15:17:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/3.ob.js | 4 ++-- src/core/4.widget.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/3.ob.js b/src/core/3.ob.js index 455b11871..9eab5d35a 100644 --- a/src/core/3.ob.js +++ b/src/core/3.ob.js @@ -73,10 +73,10 @@ // 获得一个当前对象的引用 _initRef: function () { if (this.options.__ref) { - this.options.__ref.call(this, this.$delegate || this); + this.options.__ref.call(this, this); } if (this.options.ref) { - this.options.ref.call(this, this.$delegate || this); + this.options.ref.call(this, this); } }, diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 02f74a96b..923849a6e 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -50,13 +50,13 @@ // 覆盖父类的_constructor方法,widget不走ob的生命周期 _constructed: function () { + var self = this; if (this.setup) { pushTarget(this); var delegate = this.setup(this.options); if (BI.isPlainObject(delegate)) { - this.render = delegate.render; - // setup返回一个json,即对外暴露的方法 - this.$delegate = delegate; + // 如果setup返回一个json,即对外暴露的方法 + BI.extend(this, delegate); } else { this.render = delegate; }