-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Closed
Labels
package: vue@ionic/vue package@ionic/vue package
Description
Bug Report
Ionic version:
[x] 4.4
Current behavior:
Simple tabs structure in vue project with ionic vue router. When I switch tab previous component is removed from DOM and after that It needs to be fully re-rendered when I go back to that tab. It's reproducible also on ionic-vue-conference app. But working correctly on ionic-conference-app.
Expected behavior:
Component doesn't get removed but will be hidden.
Related code:
<ion-tabs>
<ion-tab tab="dashboard">
<!-- <DashboardIndex />-->
<ion-vue-router name="dashboard" />
</ion-tab>
<ion-tab tab="benefits" :routes="['page2']">
<ion-vue-router name="page2" />
</ion-tab>
<ion-tab tab="results" :routes="['page3']">
<ion-vue-router name="page3" />
</ion-tab>
<ion-tab tab="profile" :routes="['page4']">
<ion-vue-router name="page4" />
</ion-tab>
<template slot="bottom">
<ion-tab-bar :key="1">
<ion-tab-button v-for="tab in tabs" :key="tab.routeName" :tab="tab.routeName">
<ion-label>{{ tab.title }}</ion-label>
<ion-icon name="home"></ion-icon>
</ion-tab-button>
</ion-tab-bar>
</template>
</ion-tabs>
Livijn and midoushitongtong
Metadata
Metadata
Assignees
Labels
package: vue@ionic/vue package@ionic/vue package
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
michaeltintiuc commentedon May 27, 2019
@xar what's the behaviour if the contents of the tabs are not
ion-vue-router
elements but a Vue component or simple HTML instead?michaeltintiuc commentedon May 28, 2019
@xar if you look closely, the contents of the router are now an empty comment, this is due to the fact that the router renders an empty node as it did not match the route you're currently on, this is ultimately an issue with the Vue router, you can save it's state though by doing this:
router-view
instead ofion-vue-router
keep-alive
The reason for switching to
router-view
is due to a hard requirement of thetransition
element being the parent ofkeep-alive
as per the docs. Unfortunately this is what is powering ionic transitions in Vue.xar commentedon May 29, 2019
@michaeltintiuc aa, you are correct. I understand now. In the end I have used router-view and probably will end making some ionic like transitions other way
michaeltintiuc commentedon May 30, 2019
I'll be working towards enabling
keep-alive
support forionic-vue-router
it is a nice feature to havemichaeltintiuc commentedon Jul 10, 2019
I totally forgot to mention the PR here, it's been open for quite a few days now ;)
#18561
ionitron-bot commentedon Jul 9, 2020
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionic!