Description
The scenario is, when fetching data from backend api failed, I want to route to an error page, but not changing the current location, and prompt the user that you could refresh the page to try again. If the location changed, refreshing the page would always on the error page. Another common usage is showing the login page if user is not logged in, but do not redirect to a login URL.
I know I can achieve it via putting a piece of code into App.vue:
<component :is="forceShowPage" v-if="forceShowPage"></component>
<router-view v-else></router-view>
But then these pages can't reuse the layout components that using nested routes.
Proposed API
A prop named route
for <RouterView>
that allows overriding what is displayed, like in v4 (https://next.router.vuejs.org/api/#route). There are existing tests in https://github.com/vuejs/vue-router-next/tree/master/e2e/modal