Vue-Router4.0在创建路由时 报“Cannot read property ‘forEach‘ of undefined”
解决办法
将路由规则名称更改为routes,否则报错
import { createWebHashHistory, createRouter } from 'vue-router';
// 创建路由规定
const routes = [{path: '/login',name: 'login',component: () => import('../views/login/index.vue'),},{path: '/report',name: 'report',component: () => import('../views/report/index.vue'),},
]
// 创建路由实例
const router = createRouter({history: createWebHashHistory(),routes,
})
export default router;