From 212433a599d85034fe72b34f55c5699f24b20039 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 09 一月 2025 16:22:24 +0800 Subject: [PATCH] esc 退出全屏 --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue index 0bb6cd6..c97f4cd 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue @@ -5,7 +5,7 @@ <!-- 鍏ㄥ睆鎸夐挳 --> <div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen"> - <el-tooltip :content="isFullscreen ? '閫�鍑哄叏灞�' : '鍏ㄥ睆灞曞紑'" placement="top"> + <el-tooltip content="鍏ㄥ睆灞曞紑" placement="top"> <div class="ywifont text-[20px] text-black rounded-lg ywicon-fullscreen"></div> </el-tooltip> </div> @@ -16,15 +16,15 @@ <div v-if="isFullscreen" class="absolute inset-0 z-50 w-full h-full"> <div ref="fullscreenContainerRef" class="w-full h-full"></div> <div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen"> - <el-tooltip content="閫�鍑哄叏灞�" placement="top"> + <el-tooltip content="閫�鍑哄叏灞忥紙Esc锛�" placement="top"> <div class="ywifont text-[20px] text-black rounded-lg ywicon-tuichuquanping"></div> </el-tooltip> </div> <div class="absolute bottom-0 w-full"> <EquipCurve v-model:isShow="chartDlgIsShow" - class=" opacity-90" - :data="equipCurveMapRow" + class="opacity-90" + :data="equipCurveMapRow" :quotaChartCol="data?.quota_chart?.col" height="15rem" :tableHeight="240" @@ -37,7 +37,7 @@ </template> <script setup lang="ts"> -import { onMounted, ref, nextTick, onDeactivated } from 'vue'; +import { onMounted, ref, nextTick, onDeactivated, onUnmounted } from 'vue'; import equipPic from './img/equip.svg'; import equipSelectPic from './img/equip-select.svg'; @@ -229,8 +229,18 @@ equipCurveMapRow.value = null; }; //#endregion + +// 娣诲姞 ESC 閿洃鍚嚱鏁� +const handleEscKey = (event: KeyboardEvent) => { + if (event.key === 'Escape' && isFullscreen.value) { + toggleFullScreen(); + } +}; + onMounted(async () => { await initMap(containerRef.value); + // 娣诲姞 ESC 閿洃鍚� + document.addEventListener('keydown', handleEscKey); }); onDeactivated(async () => { @@ -238,6 +248,12 @@ await toggleFullScreen(); } }); + +// 鍦ㄧ粍浠跺嵏杞芥椂绉婚櫎鐩戝惉 +onUnmounted(() => { + // 绉婚櫎 ESC 閿洃鍚� + document.removeEventListener('keydown', handleEscKey); +}); </script> <style scoped lang="scss"> :deep(.amap-info-content) { -- Gitblit v1.9.3