diff --git a/src/components/RouterSearch/index.vue b/src/components/RouterSearch/index.vue index c0352422..a8f01ed9 100644 --- a/src/components/RouterSearch/index.vue +++ b/src/components/RouterSearch/index.vue @@ -98,6 +98,8 @@ onUnmounted(() => { // 监听 ctrl + k function listenKey(event) { if ((event.ctrlKey || event.metaKey) && event.key === 'k') { + // 阻止触发浏览器默认事件 + event.preventDefault() showSearch.value = !showSearch.value // 这里可以执行相应的操作(例如打开搜索框等) }