基于Vuejs文档的例子,我尝试做一个简单的treeview组件,在这里我可以显示一个没有任何交互的账户图表(没有添加,没有拖放……非常简单)。
我在FiddleJ上做了个例子,但是我的例子很好.我不知道为什么在我的应用程序,我不能使它工作!我不知道是不是因为Vueify的问题。也许你能帮我!
这是我的密码:
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>,我第一次调用树视图组件
<oz-chart-tree :model="chart"></oz-chart-tree>问题是当我递归地调用ja .vue文件上的组件时。
正如上面所示,我得到了以下错误:
app.js:23536 Vue警告:未知的自定义元素:-您正确注册了组件吗?对于递归组件,请确保提供"name“选项。
但是是正确注册为OzTree的!我不明白!
有人知道吗?
发布于 2016-04-21 18:43:35
<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>https://stackoverflow.com/questions/36777772
复制相似问题