Vue component not showing up in laravel
Your code is correct, but it seems that you forgot to include loading css/js files in your HTML.
Add this to the <head>
:
<link rel="stylesheet" href="{{ mix('css/app.css') }}" /><script defer src="{{ mix('js/app.js') }}"></script>
I also suggest using npm run hot
(or yarn hot
), that will add hot code reload.
Try the following code by adding the default
property :
Vue.component('category-index', require('./components/CategoryIndex.vue').default);
or try this :
.... import SupplierCodeSelection from './components/SupplierCodeSelection.vue' const app = new Vue({ el: '#app', components:{'supplier-code-selection':SupplierCodeSelection } });
and
<script> export default { name:'supplier-code-selection', mounted() { console.log('Component mounted.') } } </script>
Simply add .default
:
Vue.component('supplier-code-selection', require('./components/SupplierCodeSelection.vue').default);