获得徽章 0
- routes: [
{
path: '/',
component: ()=>import('@/view/Index.vue')
},
{
name:'Ground',
path:'/ground',
component: ()=>import('@/view/Ground.vue')
},
{
name:'Index',
path:'/equipment/:c?',
component: ()=>import('@/view/Index.vue'),
beforeEnter: (to, from, next) => {
if (!to.params.c) {
// 如果参数 c 未定义,设置默认值
next({ name: 'Index', params: { c: 'rackets' } });
} else {
next();
}
}
}
]
为什么访问/ground 还是会访问到/equipment展开4点赞