最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Vuejs recursive component on Vueify - Stack Overflow

programmeradmin3浏览0评论

Based on the Vuejs Documentation examples I am trying to do a simple treeview ponent 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 {

        ponents: {
            OzTree: OzChartTree
        },

        props: {
            model: Array,
        }

    }

</script>

Where I call the first time the tree view ponent

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

The problem is when I call recursively the ponent 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 ponent correctly? For recursive ponents, make sure to provide the "name" option.

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

Somebody have any idea?

Based on the Vuejs Documentation examples I am trying to do a simple treeview ponent 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 {

        ponents: {
            OzTree: OzChartTree
        },

        props: {
            model: Array,
        }

    }

</script>

Where I call the first time the tree view ponent

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

The problem is when I call recursively the ponent 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 ponent correctly? For recursive ponents, 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 edited Dec 29, 2016 at 11:55 craig_h 32.7k7 gold badges61 silver badges70 bronze badges asked Apr 21, 2016 at 18:32 Gustavo BissolliGustavo Bissolli 1,5713 gold badges23 silver badges36 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14
<script type="text/babel">

    import OzChartTree from './OzChartTree.vue'

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

        ponents: {
            OzTree: OzChartTree
        },

        props: {
            model: Array,
        }

    }

</script>
发布评论

评论列表(0)

  1. 暂无评论