diff --git a/src/components/common/magic-cube/index.vue b/src/components/common/magic-cube/index.vue index 4916bcf2..69311aa0 100644 --- a/src/components/common/magic-cube/index.vue +++ b/src/components/common/magic-cube/index.vue @@ -3,8 +3,8 @@
@@ -70,6 +70,7 @@ const selected_active = ref(0); //#region 容器大小变更 const density = ref('4'); //#endregion + const selectingItem = reactive({ tempStart: null, tempEnd: null, @@ -77,6 +78,21 @@ const selectingItem = reactive({ end: null, }); +onMounted(() => { + // 监听点击事件 + document.addEventListener('click', outerClick); +}); +onUnmounted(() => { + // 移除监听事件 + document.removeEventListener('click', outerClick); +}); +// 判断点击的是否是可以点击的区域,其他区域隐藏掉编辑属性 +const outerClick = (e: any) => { + if (!e.target.className.includes('do-not-trigger')) { + clearSelecting(); + } +}; + const selectedList = ref(props.list); //单元魔方宽度。