From 1dfb39c2e7cb917b5f47693bf626a4860dbb2e03 Mon Sep 17 00:00:00 2001 From: sunyuqiang <1129921824@qq.com> Date: Tue, 20 Jun 2023 18:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96-=E5=BF=AB=E6=8D=B7=E9=94=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=B8=89=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/src/views/settings/index.vue | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/feature/src/views/settings/index.vue b/feature/src/views/settings/index.vue index 86f81b9..72f5b47 100644 --- a/feature/src/views/settings/index.vue +++ b/feature/src/views/settings/index.vue @@ -255,7 +255,7 @@ const setConfig = debounce(() => { watch(state, setConfig); -const changeShortCut = (e, key) => { +const changeShortCutOld = (e, key) => { if (e.altKey && e.keyCode !== 18) { const compose = `Option+${keycodes[e.keyCode].toUpperCase()}`; state.shortCut[key] = compose; @@ -274,6 +274,30 @@ const changeShortCut = (e, key) => { } }; +const changeShortCut = (e, key) => { + let compose = ''; + if (e.ctrlKey && e.keyCode !== 17) { + compose += '+Ctrl'; + } + if (e.shiftKey && e.keyCode !== 16) { + compose += '+Shift'; + } + if (e.altKey && e.keyCode !== 18) { + compose += '+Option'; + } + if (e.metaKey && e.keyCode !== 93) { + compose += '+Command'; + } + compose += '+'+keycodes[e.keyCode].toUpperCase(); + compose = compose.substring(1) + console.log(compose); + if(e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 93){ + state.shortCut[key] = compose; + }else{ + // δΈεšε€„η† + } +}; + const changeGlobalKey = (e, index) => { let compose; if (e.altKey && e.keyCode !== 18) {