@keydown 按键事件问题 #7577
Answered
by
t1000ln
t1000ln
asked this question in
Help/Questions
@keydown 按键事件问题
#7577
-
我有一个 问题是:当我按下 下面是代码片段: <div ref="sqlContent" class="sql-content" contenteditable="true" @keydown.ctrl.enter="execSql"
@keydown.ctrl.shift.f="formatSql" @keydown.ctrl.shift.b="uncommentLine"
@keydown.ctrl.b="commentLine"
></div> 函数示例: <script lang="ts" setup>
const commentLine = () => {alert('注释')}
const uncommentLine = () => {alert('反注释')}
</script> |
Beta Was this translation helpful? Give feedback.
Answered by
t1000ln
Jan 26, 2023
Replies: 1 comment
-
自己解决,也算是个办法吧! const commentLine = (e: KeyboardEvent | Event) => {
if (e instanceof KeyboardEvent && (e as KeyboardEvent).shiftKey) {
return;
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
t1000ln
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
自己解决,也算是个办法吧!