-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add support for ion-tabs #17678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add support for ion-tabs #17678
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mhartington
approved these changes
Mar 22, 2019
kiku-jw
pushed a commit
to kiku-jw/ionic
that referenced
this pull request
May 16, 2019
* 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for
ion-tabs
.The implementation creates only a single Vue component for ion-tabs, the rest of the functionality is kept as a web component.
Features
Ability to pass a string or an array of strings of route names to match tabs against to
ion-tab
via:routes
attribute. This enables us to match multiple routes against a single tab for instances of multi-language URLs or SEO-oriented URLs.Ability to pass an object containing route data to
ion-tab-button
, identical torouter-link
via:to
attribute. This enables us to have advanced functionality, starting with using route names for redirection and going as far as passing meta and reactive props data to the route object.Ability to pass a custom click handler to
ion-tab-button
allowing the user to completely override and customize the behaviour.Listen to
IonTabsWillChange
andIonTabsDidChange
events, the latter is emitted after a successful navigation and all of the async hooks have resolvedEvents lifecycle
ion-tab-button
click handlerIonTabsWillChange
event listenersIonTabsDidChange
event listenersUsage
Define the routes:
Listen to events:
The listener function will receive a single parameter of type
{ path: string }
orRoute
:The contents of the object depend on what you provided (or didn't) as value to the
:to
attribute to the givenion-tab-button
elementProvide a click-handler to
ion-tab-button
This function will be called as the first one, before any other hooks or event listeners.
Tab as a wrapper for a Vue component:
Tab as part of the Vue component:
Tabs can be rendered via the router (ionic or base) and can also be stored in cache with
keep-alive
:Since
ion-tabs
require a router, I have exported the existing ionic/vue router.Quality of Life improvements:
ion-tabs
createApi
method each time the$ionic
getter would be queried.