From 290464d55ebcda30a1603df8083d738bfc8fcc04 Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Fri, 9 Sep 2022 11:30:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8B=E7=9A=84=E5=BF=AB=E6=8D=B7=E9=94=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cpns/ClipItemList.vue | 17 +++++++++++++---- src/views/Main.vue | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/cpns/ClipItemList.vue b/src/cpns/ClipItemList.vue index f4aa5fd..97a1af9 100644 --- a/src/cpns/ClipItemList.vue +++ b/src/cpns/ClipItemList.vue @@ -80,7 +80,7 @@ const props = defineProps({ required: true } }) -const emit = defineEmits(['onDataChange', 'onDataRemove', 'onSelectItemAdd']) +const emit = defineEmits(['onDataChange', 'onDataRemove', 'onSelectItemAdd', 'onMultiCopyExecute']) const isOverSizedContent = (item) => { const { type, data } = item if (type === 'text') { @@ -242,14 +242,23 @@ onMounted(() => { } else if (isCopy) { if (props.fullData.data === '') { // 如果侧栏中有数据 证明侧栏是打开的 不执行复制 - window.copy(props.showList[activeIndex.value]) + if (!props.isMultiple) { + window.copy(props.showList[activeIndex.value]) + } else { + emit('onMultiCopyExecute', false) + } } } else if (isEnter) { - window.copy(props.showList[activeIndex.value]) - window.paste() + if (!props.isMultiple) { + window.copy(props.showList[activeIndex.value]) + window.paste() + } else { + emit('onMultiCopyExecute', true) + } } else if ((ctrlKey || metaKey || altKey) && isNumber) { window.copy(props.showList[parseInt(key) - 1]) window.paste() + selectItemList.value = [] } else if (isShift) { if (props.isMultiple) { isShiftDown.value = true diff --git a/src/views/Main.vue b/src/views/Main.vue index d069c9c..bf31c6f 100644 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -45,6 +45,7 @@ :fullData="fullData" :isMultiple="isMultiple" :currentActiveTab="outSideActiveTab" + @onMultiCopyExecute="handleMultiCopyBtnClick" @onDataChange="toggleFullData" @onDataRemove="handleDataRemove" >