From 18184d93f76715579743d1606ad91781e3b1fe98 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 17 Mar 2022 16:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20tab=20showInd?= =?UTF-8?q?ex=20function=20v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/tab.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index 2d88a81e4..b19417995 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -55,12 +55,6 @@ BI.Tab = BI.inherit(BI.Widget, { listener.on(BI.ShowListener.EVENT_CHANGE, function (value) { self.fireEvent(BI.Tab.EVENT_CHANGE, value, self); }); - - if (BI.isFunction(o.showIndex)) { - this.__watch(o.showIndex, function (context, newValue) { - self.setSelect(newValue); - }) - } }, _deleteOtherCards: function (currCardName) { @@ -85,14 +79,20 @@ BI.Tab = BI.inherit(BI.Widget, { _keepAlive: function (v) { var o = this.options; - return BI.isFunction(o.keepAlives) ? o.keepAlives(v) : BI.contains(o.keepAlives, v); + return BI.isFunction(o.keepAlives) ? o.keepAlives(v) : BI.contains(o.keepAlives, v); }, created: function () { - var o = this.options; + var self = this, o = this.options; if (o.showIndex !== false) { - this.setSelect(BI.isFunction(o.showIndex) ? o.showIndex() : o.showIndex); + if (BI.isFunction(o.showIndex)) { + var v = this.__watch(o.showIndex, function (context, newValue) { + self.setSelect(newValue); + }); + this.setSelect(v); + } + this.setSelect(o.showIndex); } },