过早客
  • 首页
  • 节点
  • 成员
  • 广告投放
  • 登录
  • 注册

基于Vue实现动态组织结构图

IT技术 • tower1229 • 发表于 7 年前 • 最后回复来自 chenley • 7 年前

vue-tree-chart

npm [license]()

Vue2树形图组件

首页:https://github.com/tower1229/Vue-Tree-Chart

logo

安装

npm i vue-tree-chart --save

使用

in template:

<TreeChart :json="treeData" />

in script:

import TreeChart from "vue-tree-chart";

export default {
    components: {
        TreeChart
    },
    data() {
        return {
            treeData: {
                ...
            }
        }
    }
    ...

属性

json

组件数据,支持字段:

- name[String] 节点名称
- image_url[String] 节点图片
- children[Array] 节点后代
- mate[Object] 节点配偶

示例:

{
    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"
      }
    ]
  }

事件

click-node

点击节点触发,接收当前节点数据为参数

演示

npm run serve

构建

npm run build-bundle

Copyright (c) 2017-present, 前端路上

加入收藏 新浪微博 分享到微信 ❤赞 6486 次点击 0 人赞 1 人收藏

打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮

共收到1条回复
chenley 7 年前 #1 赞 0

消灭0️⃣回复~~~~!

请绑定手机号后,再发言,点击此处
Guozaoke.com—源自武汉的高端交流分享社区
相关主题
iOS 过早客没有数据,大佬们求教!
GPT-5
寻有K12教育行业软件开发经验的同学合作
你们都用哪些AI工具,求分享下~
过早客flutter版来了
亲测,鸿蒙开发奖励到手了
感觉gemini已经是一骑绝尘
分享一个拥有很多好看壁纸的插件
作为后端开发工程师,你们有中途转向机器学习/深度学习的吗?
写了个过早客的暗色插件,个人感觉很好用嘿嘿

过早客微信公众号:guozaoke • 过早客新浪微博:@过早客 • 广告投放合作微信:fullygroup50 鄂ICP备2021016276号-2 • 鄂公网安备42018502001446号