hjortur17
261
7
Vue

Make sure to provide the "name" option.

Posted 4 months ago by hjortur17

Hi, I'm trying to register a component with Vue I'm getting error that sound like this: app.js:38568 [Vue warn]: Unknown custom element: < replies > - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> < ThreadView > < Root>

Here is the app.js file:

require('./bootstrap');

window.Vue = require('vue');

import Datepicker from './components/Datepicker.vue';

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

Vue.component('thread-view', require('./pages/Thread.vue'));

const app = new Vue({
    el: '#app',
    components: {Datepicker}
});

Here is the Replies.vue file:

<template>
    <div>
        <div v-for="reply in items">
            <reply :data="reply"></reply>
        </div>
    </div>
</template>

<script>
    import Reply from './Reply.vue';

    export default {
        props: ['data'],

        components: { Reply },

        data() {
            return {
                items: this.data
            }
        }
    }
</script>

And here is the Thread.vue (this file is not stored in components folder this is stored in js/pages)

<script>
    import Replies from '../components/Replies.vue';

    export default {
        components: { Replies }
    }
</script>

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