[Vuejs]-Laravel 5.8 and Vue.js components

0👍

If you still have the default js files of the Laravel installation, in your resources/js/app.js file you should have the following:

Vue.component('example-component', require('./components/ExampleComponent.vue').default);

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

The first line tells you that the name you should use for the example component is example-component, so to include it on your blade view, simply write this:

<example-component/>

The second block in the app.js file tells you that Vue will work on an element with id=”app”, so you should make sure that you have an div with that id on your layout if you want to use Vue components.

0👍

Before the body ending tag, you should include the vue script source in order to be able to implement it in your views:
<script src="{{ asset('js/app.js') }}"></script></body>

Leave a comment