!623 fix: prevent default browser action for ctrl + k key combination in RouterSearch component

Merge pull request !623 from AhJindeg/fix/router-search
This commit is contained in:
芋道源码 authored and Gitee committed 2024-12-18 12:45:14 +00:00
commit 25484a941b
1 file changed
+2
+2
View File
@@ -99,6 +99,8 @@ onUnmounted(() => {
// 监听 ctrl + k
function listenKey(event) {
if ((event.ctrlKey || event.metaKey) && event.key === 'k') {
// 阻止触发浏览器默认事件
event.preventDefault()
showSearch.value = !showSearch.value
// 这里可以执行相应的操作(例如打开搜索框等)
}