//创建路由对象并配置路由规则
let router = new VueRouter({
    routes:[
       {path:'/',redirect:{name:"index"}},  // 重定向到主页
       {name:'index',path:'/index',component:Index},
       {path:'/login',component:Login},
       {path:'/register',component:Register},
       {path:'*',component:Index},//全不匹配的情况下,返回到主页,路由按顺序从上到下,依次匹配。最后一个*能匹配全部,
       
    ]
});

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-08-16
  • 2021-11-02
猜你喜欢
  • 2022-01-30
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-02-09
  • 2022-01-20
相关资源
相似解决方案