mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
@ -4,7 +4,7 @@ import { App } from '../app/app';
|
|||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
import { DeepLinker } from '../../navigation/deep-linker';
|
import { DeepLinker } from '../../navigation/deep-linker';
|
||||||
import { Ion } from '../ion';
|
import { Ion } from '../ion';
|
||||||
import { isBlank } from '../../util/util';
|
import { isBlank, assert } from '../../util/util';
|
||||||
import { NavController } from '../../navigation/nav-controller';
|
import { NavController } from '../../navigation/nav-controller';
|
||||||
import { NavControllerBase } from '../../navigation/nav-controller-base';
|
import { NavControllerBase } from '../../navigation/nav-controller-base';
|
||||||
import { getComponent, NavOptions, DIRECTION_SWITCH } from '../../navigation/nav-util';
|
import { getComponent, NavOptions, DIRECTION_SWITCH } from '../../navigation/nav-util';
|
||||||
@ -408,14 +408,24 @@ export class Tabs extends Ion implements AfterViewInit {
|
|||||||
if (opts.updateUrl !== false) {
|
if (opts.updateUrl !== false) {
|
||||||
this._linker.navChange(DIRECTION_SWITCH);
|
this._linker.navChange(DIRECTION_SWITCH);
|
||||||
}
|
}
|
||||||
|
this._fireChangeEvent(selectedTab);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this._fireChangeEvent(selectedTab);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_fireChangeEvent(selectedTab: Tab) {
|
||||||
|
assert(this.getSelected() === selectedTab, 'selected tab does not match');
|
||||||
|
|
||||||
selectedTab.ionSelect.emit(selectedTab);
|
selectedTab.ionSelect.emit(selectedTab);
|
||||||
this.ionChange.emit(selectedTab);
|
this.ionChange.emit(selectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
_tabSwitchEnd(selectedTab: Tab, selectedPage: ViewController, currentPage: ViewController) {
|
_tabSwitchEnd(selectedTab: Tab, selectedPage: ViewController, currentPage: ViewController) {
|
||||||
|
assert(selectedTab, 'selectedTab must be valid');
|
||||||
|
assert(this._tabs.indexOf(selectedTab) >= 0, 'selectedTab must be one of the tabs');
|
||||||
|
|
||||||
// Update tabs selection state
|
// Update tabs selection state
|
||||||
const tabs = this._tabs;
|
const tabs = this._tabs;
|
||||||
let tab: Tab;
|
let tab: Tab;
|
||||||
@ -473,9 +483,10 @@ export class Tabs extends Ion implements AfterViewInit {
|
|||||||
* @return {Tab} Returns the currently selected tab
|
* @return {Tab} Returns the currently selected tab
|
||||||
*/
|
*/
|
||||||
getSelected(): Tab {
|
getSelected(): Tab {
|
||||||
for (var i = 0; i < this._tabs.length; i++) {
|
const tabs = this._tabs;
|
||||||
if (this._tabs[i].isSelected) {
|
for (var i = 0; i < tabs.length; i++) {
|
||||||
return this._tabs[i];
|
if (tabs[i].isSelected) {
|
||||||
|
return tabs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Reference in New Issue
Block a user