From 462b3489579f710c4ff35a3ae8c9d5463091235e Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 17 Mar 2022 16:21:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20tab=20sho?= =?UTF-8?q?wIndex=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index 30259e71a..2d88a81e4 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -92,7 +92,7 @@ BI.Tab = BI.inherit(BI.Widget, { created: function () { var o = this.options; if (o.showIndex !== false) { - this.setSelect(o.showIndex); + this.setSelect(BI.isFunction(o.showIndex) ? o.showIndex() : o.showIndex); } }, From 18184d93f76715579743d1606ad91781e3b1fe98 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 17 Mar 2022 16:28:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20tab=20sho?= =?UTF-8?q?wIndex=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); } }, From 3879310e3985a1526f7f6e00a099123f49437a81 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 17 Mar 2022 17:48:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20tab=20sho?= =?UTF-8?q?wIndex=20function=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/tab.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index b19417995..164b0a04b 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -23,7 +23,7 @@ BI.Tab = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; if (BI.isObject(o.tab)) { - this.tab = BI.createWidget(this.options.tab, {type: "bi.button_group"}); + this.tab = BI.createWidget(this.options.tab, { type: "bi.button_group" }); this.tab.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); @@ -45,7 +45,8 @@ BI.Tab = BI.inherit(BI.Widget, { cardCreator: function (v) { var card = o.cardCreator.apply(self, arguments); self.cardMap[v] = card; - return card; + +return card; }, afterCardShow: function (v) { self._deleteOtherCards(v); @@ -91,8 +92,9 @@ BI.Tab = BI.inherit(BI.Widget, { self.setSelect(newValue); }); this.setSelect(v); + } else { + this.setSelect(o.showIndex); } - this.setSelect(o.showIndex); } }, @@ -112,7 +114,8 @@ BI.Tab = BI.inherit(BI.Widget, { if (BI.isEqual(name, (cardname + ""))) { self.layout.deleteCardByName(name); delete self.cardMap[name]; - return true; + +return true; } }); }, @@ -131,7 +134,8 @@ BI.Tab = BI.inherit(BI.Widget, { getTab: function (v) { this._assertCard(v); - return this.layout.getCardByName(v); + +return this.layout.getCardByName(v); }, setValue: function (v) { From 957adca2484bb6b6295a0eea2b0489d7000bfae3 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 17 Mar 2022 17:49:23 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20tab=20sho?= =?UTF-8?q?wIndex=20function=20v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/tab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index 164b0a04b..893513721 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -45,8 +45,8 @@ BI.Tab = BI.inherit(BI.Widget, { cardCreator: function (v) { var card = o.cardCreator.apply(self, arguments); self.cardMap[v] = card; - -return card; + + return card; }, afterCardShow: function (v) { self._deleteOtherCards(v); @@ -114,8 +114,8 @@ return card; if (BI.isEqual(name, (cardname + ""))) { self.layout.deleteCardByName(name); delete self.cardMap[name]; - -return true; + + return true; } }); }, @@ -134,7 +134,7 @@ return true; getTab: function (v) { this._assertCard(v); - + return this.layout.getCardByName(v); },