从url中的无效参数重定向到无效的参数
vue routing
import About from './components/About.vue';
import Home from './components/Home.vue';
import Users from './components/Users.vue';
export const routes = [
{path:'', component:Home, name:'home'}
{path:'/about',component:About, name:'about'},
{path:'/users/',component:Users,name:'users'},
{path:'/users/:id',component:Users,name:'details'},
{path:'/home',redirect:{name : 'home'}},
{path:'/about',redirect:{name : 'about'}},
{path:'/users/a',redirect:'/users/:id'},
{path:'*',redirect:{name : 'home'}},
];
例如,我尝试通过URL重定向到user/a
到user/id
并且id
默认为1
,因此他将重定向到用户号码1