Giter Club home page Giter Club logo

vue3-mindmap's Introduction

vue3-mindmap

npm build coveralls

Mindmap component for Vue3 inspired by MindNode

live demo / 演示页面
Directory Description / 目录说明

Install

npm install vue3-mindmap

PROPS

Name Type Default Description
v-model Data[] undefined 设置思维导图数据
x-gap Number 84 设置节点横向间隔
y-gap Number 18 设置节点纵向间隔
branch Number 4 设置连线的宽度
scale-extent [Number, Number] [0.1, 0.8] 设置缩放范围
timetravel Boolean false 是否显示撤销重做按钮
drag Boolean false 设置节点是否可拖拽
zoom Boolean false 是否可缩放、拖移
edit Boolean false 是否可编辑
center-btn Boolean false 是否显示居中按钮
fit-btn Boolean false 是否显示缩放按钮
add-node-btn Boolean false 是否显示添加节点按钮
download-btn Boolean false 是否显示下载按钮
sharp-corner Boolean false 设置分支为圆角或直角
ctm Boolean false 是否响应右键菜单
locale 'zh' | 'en' | 'ptBR' 'zh' i18n

Example

<template>
  <mindmap v-model="data"></mindmap>
</template>

<script>
import mindmap from 'vue3-mindmap'
import 'vue3-mindmap/dist/style.css'

export default defineComponent({
  components: { mindmap },
  setup () => {
    const data = [{
      "name":"如何学习D3",
      "children": [
        {
          "name":"预备知识",
          "children": [
            { "name":"HTML & CSS" },
            { "name":"JavaScript" },
            ...
          ]
        },
        {
          "name":"安装",
          "collapse": true,
          "children": [ { "name": "折叠节点" } ]
        },
        { "name":"进阶", "left": true },
        ...
      ]
    }]

    return { data }
  }
})
</script>

注意

  • 当xGap小于一定数值,父节点的trigger由于添加按钮的存在可能遮挡住子节点的trigger,无法响应子节点的点击

待解决

  • 直角分支radius

Todo

  • 多选节点
  • 多主节点
  • 更多节点样式

vue3-mindmap's People

Contributors

hellowuxin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue3-mindmap's Issues

如何获取data数据

你好,在页面编辑完思维导图之后,能不能得到编辑后的data数据

文字对齐

Is your feature request related to a problem? Please describe.
可以设置每个节点的文字如何对齐,如居中、居左、居右。

Describe the solution you'd like
添加text-align属性

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

English Menus

Can we have option to show english menus on right click?

Demo的节点输入bug,应该和谷歌浏览器的版本升级有关

Describe the bug
选中节点编辑时,节点文字变为竖向排列,光标变长,节点的字不显示了。

To Reproduce
Steps to reproduce the behavior:

  1. 双击节点
  2. 进入节点的编辑状态

Expected behavior
编辑状态下光标和文字正常显示

Screenshots
image

Desktop (please complete the following information):

  • Browser [chrome]
  • Version [112]

Additional context
谷歌内核最近进行一次升级,升级后脑图出现了这个问题,vue2版本样式问题更严重

如何获取到编辑后的数据?怎么监听数据变化

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

完善一下文档

能否完善一下文档?如何生成图片就不知道怎么使用!

根节点如果有换行,能否设置居中?

Is your feature request related to a problem? Please describe.
节点如果有换行,都是左对齐的,对于子节点没有问题,但是对于根节点,左对齐比较影响美观,可否设置居中

Describe the solution you'd like
将根节点文字设为居中

Describe alternatives you've considered
no

Additional context
Snipaste_2021-07-21_22-40-47

作者还维护这个项目吗?

功能样式确实都很不错。
不知道是否能增加几个功能

一、键盘快捷键功能

例如:在选中节点上按:deltete键删除节点、enter键新增兄弟节点、-->键新建子节点

二、支持节点添加备忘(支持markdwon语法)功能

多选节点

Is your feature request related to a problem? Please describe.
目前只能单选节点,批量操作效率低

Describe the solution you'd like
⌘+click,⌘+drag能够多选节点

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

edit开关逻辑

你好,项目非常棒!密切关注中。
demo中关闭edit功能之后,无法编辑节点内容,但是还可以添加节点。按照逻辑,禁止编辑之后,应该也不允许再加节点了,所以禁止编辑的模式下,可否考虑将“添加节点”按钮显示为禁用状态,或者直接隐藏这个按钮

节点左右拖动布局问题

bug描述
如果把所有节点都拖到根节点左侧,这时再把某一节点拖到右侧,松开鼠标会自动回到左侧,无法按预想留在右侧。
反之都拖到右侧,也一样。

bug重现

  1. 把所有节点都拖动到左侧
  2. 这时再把任意一节点往右侧拖
  3. 期望这个节点会留在右侧
  4. 实际情况是松开鼠标后该节点会自动恢复原位

好像是个小bug

使用x-gap设置时,如果children还有分支,会出现分支重叠的问题
1618023376(1)

Direction of nodes on base element

I am using mindmap to assign nodes and its children from JS. I find it interesting that it always creates nodes on one side. Can we define the direction of the nodes being created that is left or right?

请问项目接受PR吗?

请问项目接受PR吗?
最近我也想到要做这样一个项目,但一搜,结果被你抢先做了。hahah。。。。兄弟,项目还缺人吗?

点击选中节点,如何获取当前节点的数据

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

作者你好,请问这个可以获取到点击节点的数据吗?或者每个节点点击事件响应呢?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

移动端编辑节点时,导图发生偏移

Describe the bug
移动端双击编辑节点时,当弹出软键盘时,导图会瞬间发生偏移,导致找不到编辑的节点。

To Reproduce
重现方法

  1. 移动端打开
  2. 随意缩放一下导图
  3. 双击任意节点进入编辑模式
  4. 弹出软键盘的同时,导图瞬间偏移,有时候偏移较多,直接飞出视野
  5. 似乎只有将被编辑的节点置于窗口左上角才会减少偏移,离左上角越远,编辑的时候偏移的就越多。

Expected behavior
不偏移,或者被编辑的节点居中

Smartphone (please complete the following information):

  • Device: mate40pro
  • OS: harmony
  • Browser weixin,uc
  • Version [e.g. 22]

编辑节点

Describe the bug
编辑节点的时候,不小心按了回车,再把回车删掉,结束编辑还是会有回车

To Reproduce
Steps to reproduce the behavior:

  1. 编辑节点
  2. 输入文字和回车
  3. 删除回车
  4. 结束编辑,显示还是有换行

Expected behavior
不显示换行

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.