Ionic + Vue: view not unmounting with ionRouter

Hey guys,

in Ionic + Vue it appears that using …

function navigate() {

… doesn’t unmount the previous view, while …

<IonButton router-link="/my-rout" router-direction="back">Click me</IonButton>

… does.

Is this the intended behavior? Is it possible to use ionRouter and have the view unmount? I want to navigate after clicking a submit button and have the input fields be reset.

Thanks a lot!

Please review how Ionic handles this under the Vue Lifecycle documentation. It sounds like you’d want to use Ionic’s Lifecycle events.

Ah I missed this one, thanks! Would you happen to know why “back” is treated differently and the view unmounts?

My guess is because there is no way to get back to it because you’ve gone back so there is no need to keep it around in the DOM.

1 Like