Bootstrap

vue项目中使用思维导图mindmap

 安装

npm install @hellowuxin/mindmap
or
yarn add @hellowuxin/mindmap

vue中使用

<template>
  <div class="nav">
    <mindmap
      height="500"
      width="100%"
      nodeClick
      zoomable
      showNodeAdd
      v-model="data"
    ></mindmap>
  </div>
</template>

<script>
import mindmap from "@hellowuxin/mindmap";

export default {
  components: { mindmap },
  data() {
    return {
      data: [
        {
          name: "思维导图",
          children: [
            {
              name: "标题一",
              children: [
                { name: "内容一" }, 
                { name: "内容二" }
              ],
            },
            {
              name: "标题二",
              _children: [{ name: "折叠节点" }],
            },
            {
              name: "标题三",
              left: true,
              children: [
                { name: "内容一" }, 
                { name: "内容二" }
              ],
            },
          ],
        },
      ],
    };
  },
};
</script>

API

NameTypeDefaultDescription
v-modelArrayundefined设置思维导图数据
widthNumber100%设置组件宽度
heightNumberundefined设置组件高度
xSpacingNumber80设置节点横向间隔
ySpacingNumber20设置节点纵向间隔
strokeWidthNumber4设置连线的宽度
draggableBooleantrue设置节点是否可拖拽
gpsBooleantrue是否显示居中按钮
fitViewBooleantrue是否显示缩放按钮
showNodeAddBooleantrue是否显示添加节点按钮
keyboardBooleantrue是否响应键盘事件
contextMenuBooleantrue是否响应右键菜单
nodeClickBooleantrue设置节点是否可点击、编辑
zoomableBooleantrue是否可缩放、拖移
showUndoBooleantrue是否显示撤销重做按钮

;