vue3+vite2 引入router4时报错Uncaught TypeError: Cannot use 'in' operator to search for 'path' in undefine
错误见图。
定位问题,提示在main.js:app.use(router),经查,发现是createWebHashHistory在作为参数传入时少了(),加上即可。
const router = createRouter({
history: createWebHashHistory(),
routes
})