feat: 添加多选状态下的快捷键支持

This commit is contained in:
ZiuChen 2022-09-09 11:30:40 +08:00
parent ec1c72447e
commit 290464d55e
2 changed files with 14 additions and 4 deletions

View File

@ -80,7 +80,7 @@ const props = defineProps({
required: true required: true
} }
}) })
const emit = defineEmits(['onDataChange', 'onDataRemove', 'onSelectItemAdd']) const emit = defineEmits(['onDataChange', 'onDataRemove', 'onSelectItemAdd', 'onMultiCopyExecute'])
const isOverSizedContent = (item) => { const isOverSizedContent = (item) => {
const { type, data } = item const { type, data } = item
if (type === 'text') { if (type === 'text') {
@ -242,14 +242,23 @@ onMounted(() => {
} else if (isCopy) { } else if (isCopy) {
if (props.fullData.data === '') { if (props.fullData.data === '') {
// //
if (!props.isMultiple) {
window.copy(props.showList[activeIndex.value]) window.copy(props.showList[activeIndex.value])
} else {
emit('onMultiCopyExecute', false)
}
} }
} else if (isEnter) { } else if (isEnter) {
if (!props.isMultiple) {
window.copy(props.showList[activeIndex.value]) window.copy(props.showList[activeIndex.value])
window.paste() window.paste()
} else {
emit('onMultiCopyExecute', true)
}
} else if ((ctrlKey || metaKey || altKey) && isNumber) { } else if ((ctrlKey || metaKey || altKey) && isNumber) {
window.copy(props.showList[parseInt(key) - 1]) window.copy(props.showList[parseInt(key) - 1])
window.paste() window.paste()
selectItemList.value = []
} else if (isShift) { } else if (isShift) {
if (props.isMultiple) { if (props.isMultiple) {
isShiftDown.value = true isShiftDown.value = true

View File

@ -45,6 +45,7 @@
:fullData="fullData" :fullData="fullData"
:isMultiple="isMultiple" :isMultiple="isMultiple"
:currentActiveTab="outSideActiveTab" :currentActiveTab="outSideActiveTab"
@onMultiCopyExecute="handleMultiCopyBtnClick"
@onDataChange="toggleFullData" @onDataChange="toggleFullData"
@onDataRemove="handleDataRemove" @onDataRemove="handleDataRemove"
> >