fix: 优化插件内按下ESC的功能 退出完整数据预览&清空搜索框 #16

This commit is contained in:
ZiuChen 2022-08-18 16:47:33 +08:00
parent bc7d869a3b
commit 5c1ce3140a
2 changed files with 17 additions and 1 deletions

View File

@ -16,6 +16,7 @@
<script setup>
import FileList from './FileList.vue'
import { onMounted } from 'vue'
const props = defineProps({
isShow: {
@ -30,6 +31,18 @@ const props = defineProps({
const emit = defineEmits(['onOverlayClick'])
const onOverlayClick = () => emit('onOverlayClick')
onMounted(() => {
document.addEventListener('keydown', (e) => {
const { key } = e
if (key === 'Escape' && props.fullData.data) {
// 退 Overlay
// TODO: detach utools退
emit('onOverlayClick')
e.stopPropagation()
}
})
})
</script>
<style lang="less" scoped>

View File

@ -139,7 +139,10 @@ onMounted(() => {
} else if (isSearch) {
window.focus()
} else if (isExit) {
filterText.value = ''
if (filterText.value) {
filterText.value = ''
e.stopPropagation()
}
} else if (ctrlKey) {
} else {
window.focus() //