[英]Vuejs recursive component on Vueify
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). 基于Vuejs文档示例,我试图做一个简单的树视图组件,我可以在没有任何交互的情况下显示会计科目表(没有添加任何拖放...非常简单)。
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! 我在FiddleJs上做了一个例子,但是我的例子很好用......我不知道为什么在我的应用程序上我无法使它工作! I don't know if it's some Vueify issues... may be you can help me!
我不知道是否有一些Vueify问题......可能你可以帮助我!
There is my code: 有我的代码:
OzChartTree.vue 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. 问题是当我在ja .vue文件上递归调用组件时。
As it's above I got the following error: 如上所述我得到以下错误:
app.js:23536 [Vue warn]: Unknown custom element: - did you register the component correctly?
app.js:23536 [Vue警告]:未知的自定义元素: - 您是否正确注册了组件? For recursive components, make sure to provide the "name" option.
对于递归组件,请确保提供“名称”选项。
But is is properly registered as OzTree! 但是是否正确注册为OzTree! I can't understand!
我无法理解!
Somebody have any idea? 有人有什么想法吗?
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.