[Vuejs]-Need an example vue-router (vue 2.x) for a Layout.vue with other route based components

1👍

I think this should work for you

const app = new Vue({
    router,
    render: (h) => h(App)
}).$mount('#app')

or spread operator

const app = new Vue({
    router,
    ...App
}).$mount('#app')

As I mentioned in comment, take look at the repo that I created https://github.com/bedakb/vuewp/tree/master/public/app/themes/vuewp/app

1👍

I had wrong property name:

new Vue({
  router,
  ...App
}).$mount('#app')

This fixes it. I had imported it as routes not router. Another way to fix would have been { router: routes } but I renamed the file to router and now everything works.

Big thanks to @belmin for hoping on screenhero to try and help me fix it!

👤chovy

Leave a comment