VUE CLI3路由重定向

vue cli3 的重定向无非就是使用redirect来实现

const routes = [
    {path:"/", name:"base",redirect:{name:"ResourceHome"}},
    {path:"/new", component:ResourceNew,
  children:[
    {path:"",component:ResourceName},
    {path:"other"component:RespourceOther}
  ]
 },
]
    //创建路由
    const router = createRouter({
        history:createWebHistory(),
        //第一个router是参数,第二个routes是配置路由中的routes,可以只写一个routes
        routes
    });

其他的方式引入是不变的,该引入的还是需要进行一次引入
posted @ 2020-11-22 16:56  一封未寄出的信  阅读(2231)  评论(0)    收藏  举报