(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d230098"],{eb27:function(s,a,n){"use strict";n.r(a);var t=function(){var s=this;s._self._c;return s._m(0)},e=[function(){var s=this,a=s._self._c;return a("div",[a("h1",[s._v("如何渲染一个大纲")]),a("p",[s._v("思维导图本质就是一颗树，所以你可以使用树组件来完成大纲的显示。")]),a("p",[s._v("可以监听"),a("code",[s._v("data_change")]),s._v("事件来获取当前最新的思维导图数据：")]),a("pre",{staticClass:"hljs"},[a("code",[s._v("mindMap.on("),a("span",{staticClass:"hljs-string"},[s._v("'data_change'")]),s._v(", "),a("span",{staticClass:"hljs-function"},[s._v("("),a("span",{staticClass:"hljs-params"},[s._v("data")]),s._v(") =>")]),s._v(" {\n    "),a("span",{staticClass:"hljs-comment"},[s._v("// data数据是不带节点对象的纯数据")]),s._v("\n    "),a("span",{staticClass:"hljs-comment"},[s._v("// 如果你需要操作节点对象，可以使用mindMap.renderer.renderTree")]),s._v("\n    "),a("span",{staticClass:"hljs-built_in"},[s._v("console")]),s._v(".log(data, mindMap.renderer.renderTree)\n})\n")])]),a("p",[s._v("通常点击了大纲的某个节点，会将画布定位到该节点并激活该节点，这可以这么做：")]),a("pre",{staticClass:"hljs"},[a("code",[a("span",{staticClass:"hljs-keyword"},[s._v("const")]),s._v(" node = data._node\nmindMap.renderer.moveNodeToCenter(node)\nnode.active()\n")])]),a("p",[s._v("当在大纲树上编辑了某个节点的内容，需要同步到思维导图树上：")]),a("pre",{staticClass:"hljs"},[a("code",[s._v("data._node.setText("),a("span",{staticClass:"hljs-string"},[s._v("'xxx'")]),s._v(")\n")])]),a("p",[s._v("要插入兄弟节点或子节点可以这么操作：")]),a("pre",{staticClass:"hljs"},[a("code",[s._v("mindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'INSERT_NODE'")]),s._v(", "),a("span",{staticClass:"hljs-literal"},[s._v("false")]),s._v(")\nmindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'INSERT_CHILD_NODE'")]),s._v(", "),a("span",{staticClass:"hljs-literal"},[s._v("false")]),s._v(")\n")])])])}],l={},_=l,c=n("2877"),i=Object(c["a"])(_,t,e,!1,null,null,null);a["default"]=i.exports}}]);