vue树形组件_一个vue2组件以显示树形图
vue树形组件 维树图 (vue-tree-chart)A vue2 component to display tree chart.显示树形图的vue2组件。安装 (Install)npm i vue-tree-chart --save用法 (Usage)in template:在模板中:<TreeChart :json="treeData" />in ...
·
vue树形组件
维树图 (vue-tree-chart)
A vue2 component to display tree chart.
显示树形图的vue2组件。
安装 (Install)
npm i vue-tree-chart --save
用法 (Usage)
in template:
在模板中:
<TreeChart :json="treeData" />
in script:
在脚本中:
import TreeChart from "vue-tree-chart";
export default {
components: {
TreeChart
},
data() {
return {
treeData: {
...
}
}
}
...
Struts (Prop)
json (json)
Component data to support those field:
支持这些领域的组件数据:
- name[String] to display a node name
- image_url[String] to display a node image
- children[Array] node`s children
- mate[Object] node`s mate
- extend[Boolean] show/hide node`s children, default True
Example:
例:
{
name: 'root',
image_url: "https://static.refined-x.com/avat.jpg",
children: [
{
name: 'children1',
image_url: "https://static.refined-x.com/avat1.jpg"
},
{
name: 'children2',
image_url: "https://static.refined-x.com/avat2.jpg",
mate: {
name: 'mate',
image_url: "https://static.refined-x.com/avat3.jpg"
},
children: [
{
name: 'grandchild',
image_url: "https://static.refined-x.com/avat.jpg"
},
{
name: 'grandchild2',
image_url: "https://static.refined-x.com/avat1.jpg"
},
{
name: 'grandchild3',
image_url: "https://static.refined-x.com/avat2.jpg"
}
]
},
{
name: 'children3',
image_url: "https://static.refined-x.com/avat.jpg"
}
]
}
事件 (Event)
点击节点(节点) (click-node(node))
Click on the node triggered, receive the current node data as a parameter
单击触发的节点,接收当前节点数据作为参数
运行演示 (Run a demo)
npm run serve
建立 (Build)
npm run build-bundle
翻译自: https://vuejsexamples.com/a-vue2-component-to-display-tree-chart/
vue树形组件
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)