From c9a68fa87c541bbe58d76a311b2fb204567720d7 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 9 Feb 2022 12:11:22 +0800 Subject: [PATCH] =?UTF-8?q?listeners=E6=94=AF=E6=8C=81object=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/3.ob.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/3.ob.js b/src/core/3.ob.js index 9eab5d35a..808488a76 100644 --- a/src/core/3.ob.js +++ b/src/core/3.ob.js @@ -62,7 +62,11 @@ _initListeners: function () { var self = this; if (this.options.listeners != null) { - _.each(this.options.listeners, function (lis) { + _.each(this.options.listeners, function (lis, eventName) { + if (_.isFunction(lis)) { + self.on(eventName, _.bind(lis, self)); + return; + } (lis.target ? lis.target : self)[lis.once ? "once" : "on"] (lis.eventName, _.bind(lis.action, self)); });