From ed8185052cf8b8d557fa8d4892201acda35d34e7 Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Fri, 26 Aug 2022 22:03:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87`Al?= =?UTF-8?q?t+=E6=95=B0=E5=AD=97=E9=94=AE`=E6=88=96`Ctrl+=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E9=94=AE`=E5=BF=AB=E6=8D=B7=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E5=89=8D9=E6=9D=A1=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cpns/ClipItemList.vue | 7 ++++--- src/views/Main.vue | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cpns/ClipItemList.vue b/src/cpns/ClipItemList.vue index a246ec3..e2272cc 100644 --- a/src/cpns/ClipItemList.vue +++ b/src/cpns/ClipItemList.vue @@ -94,7 +94,7 @@ onMounted(() => { const isArrowDown = key === 'ArrowDown' const isEnter = key === 'Enter' const isCopy = (ctrlKey || metaKey) && (key === 'C' || key === 'c') - const isNumber = key === '1' || '2' || '3' || '4' || '5' || '6' || '7' || '8' || '9' + const isNumber = parseInt(key) <= 9 && parseInt(key) >= 0 if (isArrowUp) { if (activeIndex.value > 0) { activeIndex.value-- @@ -117,13 +117,14 @@ onMounted(() => { } } else if (isCopy) { if (props.fullData.data === '') { + // 如果侧栏中有数据 证明侧栏是打开的 不执行复制 window.copy(props.showList[activeIndex.value]) } } else if (isEnter) { window.copy(props.showList[activeIndex.value]) window.paste() - } else if (altKey && isNumber) { - window.copy(props.showList[parseInt(key)]) + } else if ((ctrlKey || metaKey || altKey) && isNumber) { + window.copy(props.showList[parseInt(key) - 1]) window.paste() } }) diff --git a/src/views/Main.vue b/src/views/Main.vue index d2ca638..c487d26 100644 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -126,9 +126,7 @@ onMounted(() => { const { key, ctrlKey, metaKey } = e const isTab = key === 'Tab' const isSearch = - key === '/' || - (ctrlKey && (key === 'F' || key === 'f')) || - (ctrlKey && (key === 'L' || key === 'l')) + (ctrlKey && (key === 'F' || key === 'f')) || (ctrlKey && (key === 'L' || key === 'l')) const isExit = key === 'Escape' if (isTab) { const list = ['all', 'text', 'image', 'file']