先看报错:vue-router.mjs:1486 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')
at createRouterMatcher (vue-router.mjs:1486:12)
at createRouter (vue-router.mjs:2942:21)
at index.js?t=1681999549262:12:14
大概是找不到,没有定义forEach
网上看可能是view-router版本问题等,我用的是vue3,view-router用的是4以上。没有问题,最后看到Vue-Router4.0 报“Cannot read property ‘forEach‘ of undefined” - 简书 (jianshu.com)https://www.jianshu.com/p/36e48c72f848发现自己是这里错了
改正后就可以成功访问