const routes = [
{
path: '/',
component: () => import('../views/Main.vue'),
name: 'home',
children: [{
path: '/',
name: 'Home',
component: () => import('../views/home/Home.vue'),
label: '首页'
},]
},
{
path: '/login',
name: 'login',
component: () => import('../views/login.vue'),
},
]
路由文件中,name:home只能有一个
响应的,在login.vue中,路由压入,文件名也不应该是home,我这里使用了Home
const login = async () => {
const res = await proxy.$api.getmenu(loginForm)
store.commit('getMenuitem', res)
store.commit('addMenuitem', router)
router.push({ name: "Home" })
}