fix: prevent default browser action for ctrl + k key combination in RouterSearch component
- 阻止 RouterSearch 组件中 ctrl + k 组合键的默认浏览器操作pull/623/head
parent
8362665f2b
commit
413721bdfd
|
@ -98,6 +98,8 @@ onUnmounted(() => {
|
|||
// 监听 ctrl + k
|
||||
function listenKey(event) {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === 'k') {
|
||||
// 阻止触发浏览器默认事件
|
||||
event.preventDefault()
|
||||
showSearch.value = !showSearch.value
|
||||
// 这里可以执行相应的操作(例如打开搜索框等)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue