You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would allow code returning a promise to be waited for before cancelling or allowing the route change to happen. The documentation example for this navigation guard (https://next.router.vuejs.org/guide/advanced/composition-api.html#navigation-guards) uses window.confirm() which is not flexible an not likely to suit the application style.
What does the proposed API look like?
Example usage:
import { onBeforeRouteLeave } from 'vue-router';
onBeforeRouteLeave(async () => {
if (await myDialog.prompt('Save changes')) {
if (await saveChanges())
return true;
}
return false;
})