首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vueify上的Vuejs递归组件

Vueify上的Vuejs递归组件
EN

Stack Overflow用户
提问于 2016-04-21 18:32:43
回答 1查看 8.9K关注 0票数 6

基于Vuejs文档的例子,我尝试做一个简单的treeview组件,在这里我可以显示一个没有任何交互的账户图表(没有添加,没有拖放……非常简单)。

我在FiddleJ上做了个例子,但是我的例子很好.我不知道为什么在我的应用程序,我不能使它工作!我不知道是不是因为Vueify的问题。也许你能帮我!

这是我的密码:

OzChartTree.vue

代码语言:javascript
复制
<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>

,我第一次调用树视图组件

代码语言:javascript
复制
<oz-chart-tree :model="chart"></oz-chart-tree>

问题是当我递归地调用ja .vue文件上的组件时。

正如上面所示,我得到了以下错误:

app.js:23536 Vue警告:未知的自定义元素:-您正确注册了组件吗?对于递归组件,请确保提供"name“选项。

但是是正确注册为OzTree的!我不明白!

有人知道吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-21 18:43:35

代码语言:javascript
复制
<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>
票数 14
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36777772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档