hizzgdev / jsmind

a mind mapping library built by javascript

Home Page:http://hizzgdev.github.io/jsmind/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在不触发addnode的情况下去添加节点 出现问题

Qinghuand opened this issue · comments

出现报错 Uncaught (in promise) TypeError: (annot read properties of undefined (reading ' data')
使用这个进行新增 this.jsMind.add_node(node, projectPlanModel.wbsId, "", projectPlanModel, "right");
//获取初始的一个node当作 父节点
const node = Object.values(this.jsMind.mind.nodes).filter((item)return ('topId' in item) && item.wbsId === clickWbsId1)[0]
但是会报错

希望得到回答 谢谢作者

使用的版本是 0.5.2

另外我其实没看明白是哪里报错,你能不能再解释一下?

this.jsMind.add_node(node, projectPlanModel.wbsId, "", projectPlanModel, "right"); 这一句报错吗?

const node = Object.values(...).filter... 这一步获取到的 node 是什么?

另外,如果你已经知道 nodeId 的话,其实可以 jsMind.get_node(node_id) 的方法获取 node.

Uncaught (in promise) TypeError: (annot read properties of undefined (reading ' data'at v._layout_offset_subnodes (jsmind.js:810:1)
at v.layout_offset (jsmind.js:805:1)
at v.layout (jsmind.js:768:1)
at j.add_node (jsmind.js:1926:1)
at VueComponent. callee3s (index.wue:549:1)
attryCatch (runtime.js:64:1)
atGenerator.invoke (runtime .js:299:1)
atGenerator.next (runtime.js:124:1)
atasyncGeneratorstep (asyncToGenerator.js:3:1)
at_next (asyncToGenerator.js:22:1)

当我拿到node之后 再去调用 this.jsMind.add_node(node, projectPlanModel.wbsId, "", projectPlanModel, "right"); 会报上面的错误 是数据格式错误 还是 其他原因 ,这个不太清楚

你要不考虑一下使用最新的版本?我看你用了 vue,可以考虑参考这个 demo 在 vue 里引入最新版本的 jsmind

好的 我尝试一下 谢谢