atfinho
1 month ago
614
10
Vue

Error in registering a simple vue component with laravel

Posted 1 month ago by atfinho

Hey guys I'm trying to register a vue component in laravel blade and I'm getting this error

[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option

This is app.js

require('./bootstrap');


window.Vue = require('vue');
import Vue from 'vue'
import ExampleComponent from './components/ExampleComponent.vue'

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

const app = new Vue({
    el: '#app',
    components: { ExampleComponent },


});

This is my ExampleComponent.Vue

<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">Dashboard 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>

And this is my blade


<div class="content-wrapper" id="app">

    <section class="content-header">

        {{ Breadcrumbs::render('addCustomProduct',$company) }}
    </section>

    <section class="content" style="margin-top:20px;">
        <div class="row">
            <div class="container">
                <ExampleComponent> </ExampleComponent>


            </div>
        </div>

    </section>

</div>

I don't know what's wrong is happening :(

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