Vue-router error: TypeError: Cannot read property 'matched' of undefined

大城市里の小女人 提交于 2019-11-30 06:41:19

The name when you add it to Vue must be router.

import router from './routes.js'  const app = new Vue({   el: '#app',   router,   render: h => h(App) }) 

If, for whatever reason, you want to call the variable routes you could assign it this way.

import routes from './routes.js'  const app = new Vue({   el: '#app',   router: routes,   render: h => h(App) }) 

On my Vue file I had the following code:

Then, I modified my app.js file, and place the following code:

import router from './Router/router.js'  const app = new Vue({     el: '#app',     router }); 

vue & vue router & match bug & solution

match bugs

solution

name must be router

https://stackoverflow.com/a/44618867/5934465

OK


import default module bug

import default module no need {}!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!