You need to remove @yield('content')
Oct 4, 2018
21
Level 13
[Vue warn]: Unknown custom element: <example-component> - did you register the component correctly?
Laravel comes with example-component right our of the box, i was trying to add this comonent on a blade page but keep getting this error.
[Vue warn]: Unknown custom element: <example-component> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in <Root>)
this is my appl.js
require('./bootstrap');
window.Vue = require('vue');
Vue.component('example-component', require('./components/ExampleComponent.vue'));
const app = new Vue({
el: '#app',
});
this is how i call it from blade
<div id="app">
<example-component></example-component>
@yield('content')
</div>
this is the component as provided by laravel
<template>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card card-default">
<div class="card-header">Example Component</div>
<div class="card-body">
I'm an example component.
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
NOTE: npm run watch already running.
What seems to be the problem ???
Level 15
Seems like everything is good, can you see the component compiled inside /js/app.js ?
And try to past the component inside blank index.blade.php in root view (just this no other html)
<div id="app">
<example-component></example-component>
</div>
1 like
Please or to participate in this conversation.