[Vuejs]-How to configure Vuejs so that router is picked up

0👍

the Router needs to be supplied to Vue during initialization, explicitly:

new Vue({
    router: Router
})

Where Router is your import Router from '...path'.

0👍

In Main.js file do the following thing:

import router from './router'

where ‘./router’ would be the path of your router file.

then,

new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: {
    App
  },
  data() {
    return {}
  }
})

Than, supply it to the Vue in the same file (Main.js). HAPPY CODING 🙂

Leave a comment