路由出問題了,請教老師
編譯時報錯如下:
?ERROR? Failed to compile with 1 error? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?21:47:17
?error? in ./src/router/index.js
Module not found: Error: Can't resolve 'vue-router' in 'D:\todolist\src\router'
ERROR in ./src/router/index.js 1:0-60
Module not found: Error: Can't resolve 'vue-router' in 'D:\todolist\src\router'
?@ ./src/main.js 3:0-30 5:30-36
webpack compiled with 1 error
2023-06-03
引用路徑錯了
你的router文件夾應(yīng)該是在src里面的,所以路徑不能帶 src
...from ./router 會默認找到router里面的 index.js?
所以只需要寫 import router from './router'