I use Laravel 5.3 with Vue 2 and Vue Router but my component is not visible. Foo and Bar are working.
Here is my App.js
/**
* Load JavaScript dependencies
*/
require('./bootstrap');
/**
* Import Vue and VueRouter
*/
import Vue from 'vue'
import VueRouter from 'vue-router'
/**
* Import Components
*/
import UsersIndex from './components/users/Index.vue'
import Example from './components/Example.vue'
/**
* Use VueRouter
*/
Vue.use(VueRouter)
/**
* Define components
*/
const Foo = { template: '<div>Foo</div>' }
const Bar = { template: '<div>Bar</div>' }
/**
* Create Router
*/
const router = new VueRouter({
mode: 'history',
routes: [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar },
{
path: '/users',
components: {
component: UsersIndex
}
}
]
})
/**
* Create Vue instance and inject router
*/
new Vue({
router
}).$mount('#app')
I don't get any error in the vuejs dev tools. But my UsersIndex Component is not visible.
Any idea?
Update
If I try
{
path: '/users',
component: UsersIndex
}
I get the following Vue warning
[Vue warn]: Failed to mount component: template or render function not defined.