Unknown custom element: vue.js

Here is working example. I was missing Vue.use(VueRouter); I added this and it worked for me.

import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import LoginBlock from './components/LoginBlock.vue'
Vue.config.productionTip = false
const routes = [
  { path: '/foo', component: HelloWorld },
  { path: '/bar', component: LoginBlock }
]
const router = new VueRouter({
  routes // short for `routes: routes`
})
Vue.use(VueRouter);
new Vue({
  router, 
  render: h => h(App),
}).$mount('#app')


Advertisements

Add Comment