mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-15 04:06:59 +08:00
feat: 设置页支持ESC返回上一级
This commit is contained in:
parent
e8b14513c4
commit
18cbab4bda
@ -76,7 +76,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import setting from '../global/readSetting'
|
import setting from '../global/readSetting'
|
||||||
import restoreSetting from '../global/restoreSetting'
|
import restoreSetting from '../global/restoreSetting'
|
||||||
@ -189,8 +189,22 @@ const handleRestoreBtnClick = () => {
|
|||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 键盘监听事件 监听ESC按下 退出设置页
|
||||||
|
const keyDownHandler = (e) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
emit('back')
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
listenStatus.value = window.listener.listening
|
listenStatus.value = window.listener.listening
|
||||||
|
document.addEventListener('keydown', keyDownHandler)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
// 移除监听事件
|
||||||
|
document.removeEventListener('keydown', keyDownHandler)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user