feat(vue): support for ion-tabs (#17678)

* Add ion-tabs support, QOL fixes

* Fix @ionic/core version, rebuild core to include docs

* Update router

* Add support for IonTabsWillChange and IonTabsDidChange events

* Update usage docs

* Merge core and user provided click handlers in ion-tab-button

* rename file to be consistent
This commit is contained in:
Michael Tintiuc
2019-03-22 16:56:53 +02:00
committed by Mike Hartington
parent 439b10e10d
commit ee7167512f
9 changed files with 347 additions and 171 deletions

View File

@ -11,7 +11,7 @@ import {
import { IonicConfig } from '@ionic/core';
import { appInitialize } from './app-initialize';
import { VueDelegate } from './controllers/vue-delegate';
import IonRouterOutlet from './components/router-outlet';
import IonTabs from './components/navigation/IonTabs';
export interface Controllers {
actionSheetController: ActionSheetController;
@ -30,10 +30,11 @@ declare module 'vue/types/vue' {
}
function createApi(Vue: VueConstructor, $root: VueImport) {
function createApi(Vue: VueConstructor) {
const cache: Partial<Controllers> = {};
const vueDelegate = new VueDelegate(Vue, $root);
const api: Controllers = {
const vueDelegate = new VueDelegate(Vue);
return {
get actionSheetController() {
if (!cache.actionSheetController) {
cache.actionSheetController = new ActionSheetController();
@ -77,8 +78,6 @@ function createApi(Vue: VueConstructor, $root: VueImport) {
return cache.toastController;
}
};
return api;
}
let Vue: typeof VueImport;
@ -94,11 +93,13 @@ export const install: PluginFunction<IonicConfig> = (_Vue, config) => {
}
Vue = _Vue;
Vue.config.ignoredElements.push(/^ion-/);
Vue.component('IonRouterView', IonRouterOutlet);
Vue.component('IonTabs', IonTabs);
appInitialize(config);
const api = createApi(Vue);
Object.defineProperty(Vue.prototype, '$ionic', {
get() { return createApi(Vue, this.$root); }
get() { return api; }
});
};