Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Based on the Vuejs Documentation examples I am trying to do a simple treeview component where I can show a Chart of Accounts without any interection (no add no drag and drop... really simple).

I have made an example on FiddleJs but there works fine my example... I don't know why on my app I can't make it works! I don't know if it's some Vueify issues... may be you can help me!

There is my code:

OzChartTree.vue

<template>

    <ul v-if="model.length">
        <li v-for="m in model" :class="{ 'is-group': m.children }">
            {{ m.name }}
            <ul v-if="m.accounts">
                <li v-for="a in m.accounts">
                    {{ a.name }}
                </li>
            </ul>
            <oz-tree :model="m"></oz-tree>
        </li>
    </ul>

</template>

<script type="text/babel">

    import OzChartTree from './OzChartTree.vue'

    export default {

        components: {
            OzTree: OzChartTree
        },

        props: {
            model: Array,
        }

    }

</script>

Where I call the first time the tree view component

<oz-chart-tree :model="chart"></oz-chart-tree>

The problem is when I call recursively the component on ja .vue file.

As it's above I got the following error:

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

But is is properly registered as OzTree! I can't understand!

Somebody have any idea?

share|improve this question
up vote 6 down vote accepted
<script type="text/babel">

    import OzChartTree from './OzChartTree.vue'

    export default {
        name: 'oz-tree-chart', // this is what the Warning is talking about.

        components: {
            OzTree: OzChartTree
        },

        props: {
            model: Array,
        }

    }

</script>
share|improve this answer
1  
documentation for recursive components: vuejs.org/guide/components.html#Recursive-Component – Jeff Apr 21 '16 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.