diff --git a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue index d77debce8d..935c23a919 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/ContextMenuDetails.vue @@ -53,8 +53,12 @@ const menuOpt = optName => { } const cut = () => { - const curInfo = getCurInfo() - copyStore.cut(curInfo.componentData) + if (curComponent.value) { + const curInfo = getCurInfo() + copyStore.cut(curInfo.componentData) + } else if (areaData.value.components.length) { + copyStore.cut() + } menuOpt('cut') } diff --git a/core/core-frontend/src/store/modules/data-visualization/copy.ts b/core/core-frontend/src/store/modules/data-visualization/copy.ts index 27d6ab41cc..e61afca528 100644 --- a/core/core-frontend/src/store/modules/data-visualization/copy.ts +++ b/core/core-frontend/src/store/modules/data-visualization/copy.ts @@ -129,6 +129,15 @@ export const copyStore = defineStore('copy', { composeStore.areaData.components.forEach(component => { dvMainStore.deleteComponentById(component.id) }) + composeStore.setAreaData({ + style: { + left: 0, + top: 0, + width: 0, + height: 0 + }, + components: [] + }) } snapshotStore.recordSnapshotCache() this.isCut = true