mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 02:31:34 +08:00
refactor(tabs): don't deselect previous tab if it's the same as current tab
This commit is contained in:
@ -98,18 +98,11 @@ export class Tabs {
|
||||
}
|
||||
selectedTab.selected = true;
|
||||
|
||||
// The same selected was selected
|
||||
// we need to set root in the nested ion-nav if it exist
|
||||
/*if (this.selectedTab === selectedTab) {
|
||||
return selectedTab.goToRoot();
|
||||
}
|
||||
*/
|
||||
|
||||
const leavingTab = this.selectedTab;
|
||||
this.selectedTab = selectedTab;
|
||||
|
||||
let promise = selectedTab.setActive(true);
|
||||
if (leavingTab) {
|
||||
if (leavingTab && leavingTab !== selectedTab) {
|
||||
promise = promise.then(() => leavingTab.setActive(false));
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,13 @@
|
||||
</head>
|
||||
<body>
|
||||
<ion-tabs>
|
||||
<ion-tab title="Plain List" icon="star" path="">
|
||||
<div class="div-one">Div One</div>
|
||||
<ion-tab title="Tab One" icon="star" path="">
|
||||
<div class="div-one" slot="not-initialized">Div One</div>
|
||||
</ion-tab>
|
||||
|
||||
<ion-tab title="Schedule" icon="globe" path="tab2">
|
||||
<div class="div-two">Div Two</div>
|
||||
<ion-tab title="Tab Two" icon="globe" path="tab2">
|
||||
<div class="div-two" slot="not-initialized">Div Two</div>
|
||||
</ion-tab>
|
||||
|
||||
<ion-tab title="Schedule" icon="save" path="tab2">
|
||||
<div class="div-three">Div Three</div>
|
||||
</ion-tabs>
|
||||
|
||||
<style>
|
||||
@ -35,12 +32,6 @@
|
||||
height: 100%;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.div-three {
|
||||
background-color: green;
|
||||
height: 100%;
|
||||
color: #FFF;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user