My router
configuration:
{
path: '/user',
name: 'user',
component: Layout,
// redirect: '/user/detail',
isAlive: false,
meta: {
title: '111',
superTitle: '222',
},
children: [
{
path: '',
name: 'UserDetail',
component: () => import('@/pages/order/userOrder.vue'),
},
],
},
{
path: '/order',
name: 'order',
component: Layout,
redirect: '/order/detail',
meta: {
title: '333',
},
children: [
{
path: 'detail',
name: 'detail',
component: () => import('@/pages/order/index.vue'),
},
{
path: 'after',
name: 'after',
component: () => import('@/pages/order/after.vue'),
},
],
},
My components:
<router-view v-if="!isRefreshing" v-slot="{ Component }">
<transition name="fade" mode="out-in">
<keep-alive>
<component :is="Component" />
</keep-alive>
</transition>
</router-view>
If I enter the url directly from the browser’s address bar, both two pages(user
and order
) will display normally, but if I open one page and then try to use routing to jump to another page, the url will change normally, but the router-view
will disappear.
After investigation, I found that the transition
component caused this phenomenon. If I delete the transition component, the route
can jump normally.