From f707ac41f1a41ea8f9c649a41b17ac86b4588de0 Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Thu, 25 Aug 2022 22:10:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=8C=89=E4=BD=8F`Al?= =?UTF-8?q?t+=E6=95=B0=E5=AD=97=E9=94=AE`=E5=BF=AB=E9=80=9F=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cpns/ClipItemList.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cpns/ClipItemList.vue b/src/cpns/ClipItemList.vue index 974b730..82d5914 100644 --- a/src/cpns/ClipItemList.vue +++ b/src/cpns/ClipItemList.vue @@ -81,11 +81,12 @@ watch( onMounted(() => { // 监听键盘事件 document.addEventListener('keydown', (e) => { - const { key, ctrlKey, metaKey } = e + const { key, ctrlKey, metaKey, altKey } = e const isArrowUp = key === 'ArrowUp' 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' if (isArrowUp) { if (activeIndex.value > 0) { activeIndex.value-- @@ -113,6 +114,9 @@ onMounted(() => { } else if (isEnter) { window.copy(props.showList[activeIndex.value]) window.paste() + } else if (altKey && isNumber) { + window.copy(props.showList[parseInt(key)]) + window.paste() } }) })