vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined

页面启动时报错:
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第1张图片
错误原因:createWebHashHistory是方法,不是变量,但是这里当成了变量去用
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第2张图片
解决:
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第3张图片
再次启动,不报这个错误了,但是出现了新的错误

TypeError: Cannot use 'in' operator to search for 'catch' in undefined

vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第4张图片
错误原因:配置路由的时候,component那里使用了箭头函数
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第5张图片
解决:
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第6张图片
再次启动,页面就不报错了
vue-router.mjs:3028 Uncaught TypeError: Cannot use ‘in‘ operator to search for ‘path‘ in undefined_第7张图片
第一次尝试自己搭建前端项目,出的错,希望能帮到其他遇到这种问题的小伙伴吧

你可能感兴趣的:(vue.js,前端,javascript)