mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 14:24:03 +08:00
feat: 添加按住Alt+数字键
快速选择的功能
This commit is contained in:
parent
0c84471671
commit
f707ac41f1
@ -81,11 +81,12 @@ watch(
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 监听键盘事件
|
// 监听键盘事件
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
const { key, ctrlKey, metaKey } = e
|
const { key, ctrlKey, metaKey, altKey } = e
|
||||||
const isArrowUp = key === 'ArrowUp'
|
const isArrowUp = key === 'ArrowUp'
|
||||||
const isArrowDown = key === 'ArrowDown'
|
const isArrowDown = key === 'ArrowDown'
|
||||||
const isEnter = key === 'Enter'
|
const isEnter = key === 'Enter'
|
||||||
const isCopy = (ctrlKey || metaKey) && (key === 'C' || key === 'c')
|
const isCopy = (ctrlKey || metaKey) && (key === 'C' || key === 'c')
|
||||||
|
const isNumber = key === '1' || '2' || '3' || '4' || '5' || '6' || '7' || '8' || '9'
|
||||||
if (isArrowUp) {
|
if (isArrowUp) {
|
||||||
if (activeIndex.value > 0) {
|
if (activeIndex.value > 0) {
|
||||||
activeIndex.value--
|
activeIndex.value--
|
||||||
@ -113,6 +114,9 @@ onMounted(() => {
|
|||||||
} else if (isEnter) {
|
} else if (isEnter) {
|
||||||
window.copy(props.showList[activeIndex.value])
|
window.copy(props.showList[activeIndex.value])
|
||||||
window.paste()
|
window.paste()
|
||||||
|
} else if (altKey && isNumber) {
|
||||||
|
window.copy(props.showList[parseInt(key)])
|
||||||
|
window.paste()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user