从网址中的无效参数重定向到无效

时间:2019-06-16 12:39:04

标签: vue.js

从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/auser/id 并且id默认为1,因此他将重定向到用户号码1

0 个答案:

没有答案