| 43 | @Event({ bubbles: false }) ionTabsDidChange!: EventEmitter<{ tab: string }>; |
| 44 | |
| 45 | async componentWillLoad() { |
| 46 | if (!this.useRouter) { |
| 47 | /** |
| 48 | * JavaScript and StencilJS use `ion-router`, while |
| 49 | * the other frameworks use `ion-router-outlet`. |
| 50 | * |
| 51 | * If either component is present then tabs will not use |
| 52 | * a basic tab-based navigation. It will use the history |
| 53 | * stack or URL updates associated with the router. |
| 54 | */ |
| 55 | this.useRouter = |
| 56 | (!!this.el.querySelector('ion-router-outlet') || !!document.querySelector('ion-router')) && |
| 57 | !this.el.closest('[no-router]'); |
| 58 | } |
| 59 | if (!this.useRouter) { |
| 60 | const tabs = this.tabs; |
| 61 | if (tabs.length > 0) { |
| 62 | await this.select(tabs[0]); |
| 63 | } |
| 64 | } |
| 65 | this.ionNavWillLoad.emit(); |
| 66 | } |
| 67 | |
| 68 | componentDidLoad() { |
| 69 | this.updateTabBar(); |