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