2👍
✅
You should inject the router to the component like that:
Vue.customElement('schools-widget', {
router,
render: h => h(App)
});
Update 1:
Just found out that you forgot to install the Vue router plugin:
Vue.use(VueRouter)
-3👍
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import Schools from "./components/Schools";
import School from "./components/Schools";
const router = new VueRouter({
routes: [
{ path: '/', component: Schools },
{ path: '/school', component: School },
]
})
new Vue({
router,
render: (h) => h(App),
}).$mount('#app');
I think your code should be like this.
Source:stackexchange.com