(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0afe0d"],{"0fcd":function(s,a,t){"use strict";t.r(a);var n=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("h2",[s._v("插入子节点")]),a("p",[s._v("插入子节点很节点，执行"),a("code",[s._v("INSERT_CHILD_NODE")]),s._v("命令即可：")]),a("pre",{staticClass:"hljs"},[a("code",[s._v("mindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'INSERT_CHILD_NODE'")]),s._v(")\n")])]),a("p",[s._v("这样就会在当前激活节点（如果存在多个激活节点，默认会操作第一个激活节点）下添加一个子节点。")]),a("p",[a("code",[s._v("INSERT_CHILD_NODE")]),s._v("命令还支持传入几个参数，详细详细请阅读【API】-【构造函数】-【execCommand方法】。")]),a("h2",[s._v("插入兄弟节点")]),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(")\n")])]),a("h2",[s._v("删除节点")]),a("p",[s._v("删除节点也是执行命令：")]),a("pre",{staticClass:"hljs"},[a("code",[s._v("mindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'REMOVE_NODE'")]),s._v(")\n")])]),a("p",[s._v("会删除当前激活的所有节点。")]),a("h2",[s._v("前进回退")]),a("p",[s._v("首先需要监听"),a("code",[s._v("back_forward")]),s._v("事件，事件回调中可以获取当前的历史记录总数，以及当前所在的历史记录索引，那么就可以判断当前是否处于历史记录的最开始，还是最后，然后对前进回退按钮进行禁用。")]),a("pre",{staticClass:"hljs"},[a("code",[a("span",{staticClass:"hljs-keyword"},[s._v("const")]),s._v(" isStart = ref("),a("span",{staticClass:"hljs-literal"},[s._v("true")]),s._v(")\n"),a("span",{staticClass:"hljs-keyword"},[s._v("const")]),s._v(" isEnd = ref("),a("span",{staticClass:"hljs-literal"},[s._v("true")]),s._v(")\nmindMap.on("),a("span",{staticClass:"hljs-string"},[s._v("'back_forward'")]),s._v(", "),a("span",{staticClass:"hljs-function"},[s._v("("),a("span",{staticClass:"hljs-params"},[s._v("index, len")]),s._v(") =>")]),s._v(" {\n    isStart.value = index <= "),a("span",{staticClass:"hljs-number"},[s._v("0")]),s._v("\n    isEnd.value = index >= len - "),a("span",{staticClass:"hljs-number"},[s._v("1")]),s._v("\n})\n")])]),a("p",[s._v("然后前进回退调用相关命令即可：")]),a("pre",{staticClass:"hljs"},[a("code",[a("span",{staticClass:"hljs-comment"},[s._v("// 回退一次")]),s._v("\nmindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'BACK'")]),s._v(")\n\n"),a("span",{staticClass:"hljs-comment"},[s._v("// 前进一次")]),s._v("\nmindMap.execCommand("),a("span",{staticClass:"hljs-string"},[s._v("'FORWARD'")]),s._v(")\n")])]),a("h2",[s._v("完整示例")]),a("iframe",{staticStyle:{width:"100%",height:"455px",border:"none"},attrs:{src:"https://wanglin2.github.io/playground/#eNrFVt1qG0cUfpXTLUVykVYy9EqVRBxZpaaxXZTSXmSCWe2OpGl2Z5bdkeRgBCYkkP7RtKWU1tCm0NJetKUXpRCnIS/jtZ236Jmd/dMPWLmKYMXOnHO+78ycM9/OkbHl++ZkTI2G0QztgPkSQirHfptw5vkikHAEAR1UQPBdMeaSOhUIR5brimmPDmAGg0B4UEKEUhaxy7iza/naRIwQp11a9XC26lk+MQgHINylEtSc8mwBH7su4YTXanD519/Rs2+jT764fH4Snfz44viYcFvwUAILb0oLCVoqpbIMxnQjN3W5M29QJAgXPfsGsc6fH5//8/Tih/uXn967uPckevjd5c+/p8GWLdmE7gmHhgiRL6986zbiaJS5RPqWfQc9yxvQasORokpWYtJDaneE51ncKZeub3XeKyHCLAWJ15SCDEQwtQKV9FU47+z3PtrqbRehzr/8Onrwa/TgfvTfT3pJ2U7wkAZSLWYN5J29m93eBwd7+9vdFeh/PloF3Rkx13k5/M67Oze2l1iih49ffP/LPIVDsS/iUqyB3uvu7n/YncfN+rS8HK36jE7T/izHJgDqNsAR9tijXJpDKrsuVa/X7+4gRRLZEVxajNOgtFHRUY4lrYZGVz9iqAliFKb0tKSHUk0T4/zxk2St8QlQv1kCphxtta0B5cr5Vo6xALeSZZHp7PTzi9PfFsnmCVeQ3s5tRb9XlEH6msylcYwz2RMibvD3RcgkExwjSy4dyFIFSjaWDssUR8023tYyAIDtdnHyVfToD52TloOz08/Onv5bbC/ByyWOyAdaEhCwrIYVUP83WCjznoKibJgTyx2rlk39NH3CTmR2+LWOrCZWqnKQqIJiRhM9rIBLeZEVt0DLYMYZ+0GzBfXcA9Vwwd5uKSSowmaam3qaNa36qPc4kBSl2pIURwBNh03Adq0wbBEjyXObeoIYsTlxYE5uzU4JujRraC06pkhSCLdvKRdtJLLZH0spOFyzXWbfQRe1EcSASZUNcPRasl6M0LvXrOmABADxFwGSTZzDwB1RCHEVrkbIVTQHKdYbt3IoR9DGPTfay2K8LkGmpeuzpKJ8NUWupWugF8V4ATovZfrWrBU6BYehvOvqprmW3AGIYdb0hz9RW5OGnmmHITGyM2kWmirt7ilz5KgBm/X6G7EfgJ8d8oAiI2YfG2J9UM/ri82XQuWBVj8U7ljqQMBjMJANqCcjKfx8sEw/omw4Qve36nX/MGVezftmyuxZwZAhb4rqW47D+DCdyFI3k7OwZsabaQZJ0tkYAfEcxzUwKoaugLpqmR+HguPNLobHlosNWIFMvImBFzet2GYNX80AP53Mo6pY1X4gptijCEKMRHxXXOZ07HKpVVSS28yY/Q8ZbqFI"}})])}],i={},l=i,v=t("2877"),c=Object(v["a"])(l,n,e,!1,null,null,null);a["default"]=c.exports}}]);