在创建vue3的路由时,报了这样的错:Cannot use 'in' operator to search for 'path' in undefined,经过多次排查发现是我在路由文件里面用错了createWebHashHistory()方法,将它用成了 变量。
一、报错情况
![](https://i-blog.csdnimg.cn/blog_migrate/665646f5d166be1c65e235b0280253c9.png)
image.png
二、报错原因及解决
报这样的错误是因为我在路由文件里用错了createWebHashHistory()方法,将它用成了变量,只需要将它写成方法即可解决问题。
![](https://i-blog.csdnimg.cn/blog_migrate/363693447c1a996a47b4c110744e4136.png)
image.png