mirror of https://gitee.com/godoos/godoos.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.7 KiB
1 lines
2.7 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2082b9"],{a43c:function(s,t,n){"use strict";n.r(t);var v=function(){var s=this;s._self._c;return s._m(0)},a=[function(){var s=this,t=s._self._c;return t("div",[t("h1",[s._v("KeyCommand实例")]),t("p",[t("code",[s._v("keyCommand")]),s._v("实例负责快捷键的添加及触发,内置了一些快捷键,也可以自行添加。可通过"),t("code",[s._v("mindMap.keyCommand")]),s._v("获取到该实例。")]),t("h2",[s._v("方法")]),t("h3",[s._v("addShortcut(key, fn)")]),t("p",[s._v("添加快捷键")]),t("p",[t("code",[s._v("key")]),s._v(":快捷键按键,按键值可以通过"),t("a",{attrs:{href:"https://github.com/wanglin2/mind-map/blob/main/simple-mind-map/src/core/command/keyMap.js"}},[s._v("keyMap.js")]),s._v("查看。示例:")]),t("pre",{staticClass:"hljs"},[t("code",[t("span",{staticClass:"hljs-comment"},[s._v("// 单个按键")]),s._v("\nmindMap.keyCommand.addShortcut("),t("span",{staticClass:"hljs-string"},[s._v("'Enter'")]),s._v(", "),t("span",{staticClass:"hljs-function"},[s._v("() =>")]),s._v(" {})\n"),t("span",{staticClass:"hljs-comment"},[s._v("// 或")]),s._v("\nmindMap.keyCommand.addShortcut("),t("span",{staticClass:"hljs-string"},[s._v("'Del|Backspace'")]),s._v(", "),t("span",{staticClass:"hljs-function"},[s._v("() =>")]),s._v(" {})\n"),t("span",{staticClass:"hljs-comment"},[s._v("// 组合键")]),s._v("\nmindMap.keyCommand.addShortcut("),t("span",{staticClass:"hljs-string"},[s._v("'Control+Enter'")]),s._v(", "),t("span",{staticClass:"hljs-function"},[s._v("() =>")]),s._v(" {})\n")])]),t("p",[t("code",[s._v("fn")]),s._v(":要执行的方法")]),t("h3",[s._v("removeShortcut(key, fn)")]),t("p",[s._v("移除快捷键命令,"),t("code",[s._v("fn")]),s._v("不指定则移除该快捷键的所有回调方法")]),t("h3",[s._v("getShortcutFn(key)")]),t("blockquote",[t("p",[s._v("v0.2.2+")])]),t("p",[s._v("获取指定快捷键的处理函数")]),t("h3",[s._v("pause()")]),t("blockquote",[t("p",[s._v("v0.2.2+")])]),t("p",[s._v("暂停所有快捷键响应")]),t("h3",[s._v("recovery()")]),t("blockquote",[t("p",[s._v("v0.2.2+")])]),t("p",[s._v("恢复快捷键响应")]),t("h3",[s._v("save()")]),t("blockquote",[t("p",[s._v("v0.2.3+")])]),t("p",[s._v("保存当前注册的快捷键数据,然后清空快捷键数据")]),t("h3",[s._v("restore()")]),t("blockquote",[t("p",[s._v("v0.2.3+")])]),t("p",[s._v("恢复保存的快捷键数据,然后清空缓存数据")]),t("h3",[s._v("hasCombinationKey(e)")]),t("blockquote",[t("p",[s._v("v0.6.13+")])]),t("ul",[t("li",[t("code",[s._v("e")]),s._v(":事件对象。")])]),t("p",[s._v("判断是否按下了组合键。")])])}],_={},e=_,o=n("2877"),c=Object(o["a"])(e,v,a,!1,null,null,null);t["default"]=c.exports}}]);
|