fix(tab-bar): use as standalone in vue #29925
Open
+45
−11
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.
Issue number: resolves #29885
What is the current behavior?
Vue: Tab bar could be a standalone element within
ion-tabs
and would navigate without issues with a router outlet before v8.3:It would work as if it was written as:
After v8.3, any
ion-tab-bar
that was not a direct child ofion-tabs
would lose it's expected behavior when used with a router outlet. If a user clicked on a tab button, then the content would not be redirected to that expected view.What is the new behavior?
The Vue tab bar's
_hasRouterOutlet
prop has been modified to accept both Boolean andundefined
values. When the value isundefined
, it indicates that theion-tab-bar
component was not found within the slotted content ofion-tabs
. This typically occurs when the tab bar is not passed as a direct child ofion-tabs
.In such cases, the tab bar will perform its own check to determine if an
ion-router-outlet
is present. This check cannot be handled bytabs
, as it would need to wait until after mounting to access the DOM, which would be too late since the tab bar would have already executed the logic that depends on_hasRouterOutlet
.Does this introduce a breaking change?
Other information
Dev build:
8.3.3-dev.11728341918.1d3d4b3f
How to test:
8.3.0-standalone
npm install @ionic/vue@8.3.3-dev.11728341918.1d3d4b3f