mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 06:16:18 +08:00
fix: 优化插件内按下ESC的功能 退出完整数据预览&清空搜索框 #16
This commit is contained in:
parent
bc7d869a3b
commit
5c1ce3140a
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FileList from './FileList.vue'
|
import FileList from './FileList.vue'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isShow: {
|
isShow: {
|
||||||
@ -30,6 +31,18 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['onOverlayClick'])
|
const emit = defineEmits(['onOverlayClick'])
|
||||||
const onOverlayClick = () => emit('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>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@ -139,7 +139,10 @@ onMounted(() => {
|
|||||||
} else if (isSearch) {
|
} else if (isSearch) {
|
||||||
window.focus()
|
window.focus()
|
||||||
} else if (isExit) {
|
} else if (isExit) {
|
||||||
|
if (filterText.value) {
|
||||||
filterText.value = ''
|
filterText.value = ''
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
} else if (ctrlKey) {
|
} else if (ctrlKey) {
|
||||||
} else {
|
} else {
|
||||||
window.focus() // 其他键盘事件 直接聚焦搜索框
|
window.focus() // 其他键盘事件 直接聚焦搜索框
|
||||||
|
Loading…
x
Reference in New Issue
Block a user