[Vuejs]-Define vue component in Laravel

0👍

Register the vue components before you instantiate your root vue instance

    require('./bootstrap');

// register components

Vue.component('example', require('./components/Example.vue'));

Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue')
);

Vue.component(
   'passport-authorized-clients',
   require('./components/passport/AuthorizedClients.vue')
);

Vue.component(
   'passport-personal-access-tokens',
   require('./components/passport/PersonalAccessTokens.vue')
);

Vue.component('employer-enquiry-names', 
require('./components/Employer/Enquiry/Edit/Names.vue'));
Vue.component('employer-enquiry-users', 
require('./components/Employer/Enquiry/Edit/Users.vue'));
Vue.component('employer-enquiry-employer', 
require('./components/Employer/Enquiry/Edit/Employer.vue'));

//instantiate root vue instance

const app = new Vue({
    el: '#app'
});

Note: do not mount root vue instance on the body element. Its better you create a wrapper element with some id like #app an mount the vue instance on this wrapper element.

This is not recommended in vue 2.0 which yeilds a warning. See release notes

Leave a comment