mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00
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:

committed by
Mike Hartington

parent
439b10e10d
commit
ee7167512f
@ -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; }
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user