Skip to content
Advertisement

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

I’m trying to write my first Vuejs app. I’m using vue-cli and simple-webpack boilerplate.

When I add vue-router links to my app component I get this error in console

Error in render function: “TypeError: Cannot read property ‘matched’ of undefined”

Here is my code:

App.vue

JavaScript

main.js

JavaScript

routes.js

JavaScript

Advertisement

Answer

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

JavaScript

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

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement