nhayder
1091
20
Vue

[Vue warn]: Unknown custom element: <example-component> - did you register the component correctly?

Posted 7 months ago by nhayder

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 ???

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.