Reputation: 402
working with Laravel 5.7 and Vue Js. this is
app.js
let Myheader = require('./components/Myheader.vue');
let Myfooter = require('./components/Myfooter.vue');
const app = new Vue({
el: '#app',
components:{Myheader,Myfooter}
});
blade.php file
<body>
<div id="app">
<Myheader></Myheader>
<Myfooter></Myfooter>
</div>
<script src="{{ asset('js/app.js')}}"></script>
</body>
but when I run artisan serve command it is not displayed vue component. how can fix this problem?
Upvotes: 0
Views: 77
Reputation:
If you are use Laravel Mix 4.0+, try adding .default
to your requires. This is needed when you use CommonJS to import modules.
let Myheader = require('./components/Myheader.vue').default;
let Myfooter = require('./components/Myfooter.vue').default;
Upvotes: 1