fix(vue): correctly remove old view when replacing route (#22566)

resolves #22492
This commit is contained in:
Liam DeBeasi
2020-11-30 11:00:14 -05:00
committed by GitHub
parent 9d04c127e8
commit 4f4f31b65e
6 changed files with 118 additions and 21 deletions

View File

@ -238,7 +238,11 @@ export const IonRouterOutlet = defineComponent({
leavingEl.classList.add('ion-page-hidden');
leavingEl.setAttribute('aria-hidden', 'true');
if (!(routerAction === 'push' && routerDirection === 'forward')) {
if (routerAction === 'replace') {
leavingViewItem.mount = false;
leavingViewItem.ionPageElement = undefined;
leavingViewItem.ionRoute = false;
} else if (!(routerAction === 'push' && routerDirection === 'forward')) {
const shouldLeavingViewBeRemoved = routerDirection !== 'none' && leavingViewItem && (enteringViewItem !== leavingViewItem);
if (shouldLeavingViewBeRemoved) {
leavingViewItem.mount = false;