[Vuejs]-Cannot read property 'routes' of undefined

0👍

You can define prototype in router/index.js right under the declaration “Vue.prototype.$router = router;” this will make the instance available in any component.

const router = new NSVueRouter({
    //ignoreSame, // <-- Optional. Will set if reject or accept navigate to same current component.
    routes,
    /* eslint-disable-next-line no-undef  */
    //verbose: TNS_ENV !== 'production' // <-- Optional. Will output the warnings to console.
})

Vue.prototype.$router = router;

Leave a comment