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
});
其他的方式引入是不變的,該引入的還是需要進行一次引入