Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
413721bd
authored
Dec 17, 2024
by
AhJindeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: prevent default browser action for ctrl + k key combination in RouterSearch component
- 阻止 RouterSearch 组件中 ctrl + k 组合键的默认浏览器操作
parent
8362665f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/components/RouterSearch/index.vue
+2
-0
No files found.
src/components/RouterSearch/index.vue
View file @
413721bd
...
@@ -98,6 +98,8 @@ onUnmounted(() => {
...
@@ -98,6 +98,8 @@ onUnmounted(() => {
// 监听 ctrl + k
// 监听 ctrl + k
function
listenKey
(
event
)
{
function
listenKey
(
event
)
{
if
((
event
.
ctrlKey
||
event
.
metaKey
)
&&
event
.
key
===
'k'
)
{
if
((
event
.
ctrlKey
||
event
.
metaKey
)
&&
event
.
key
===
'k'
)
{
// 阻止触发浏览器默认事件
event
.
preventDefault
()
showSearch
.
value
=
!
showSearch
.
value
showSearch
.
value
=
!
showSearch
.
value
// 这里可以执行相应的操作(例如打开搜索框等)
// 这里可以执行相应的操作(例如打开搜索框等)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment