jaywcjlove / hotkeys-js

➷ A robust Javascript library for capturing keyboard input. It has no dependencies.

Home Page:https://jaywcjlove.github.io/hotkeys-js

Repository from Github https://github.comjaywcjlove/hotkeys-jsRepository from Github https://github.comjaywcjlove/hotkeys-js

快捷键 上下左右的时候 无响应

wedjava opened this issue · comments

import hotkeys, { KeyHandler } from 'hotkeys-js';
import { onMounted, onUnmounted } from 'vue';
export const useHotKeys = (key: string, callback: KeyHandler, global = true): void => {
onMounted(() => {
hotkeys(key, callback);
});
onUnmounted(() => {
if (global) {
hotkeys.unbind(key);
} else {
hotkeys.unbind(key, callback);
}
});
};
这边使用的话
useHotKeys('ctrl+n, command+n', keyHandleCreate, false);
useHotKeys('arrowup, arrowdown,ArrowDown,ArrowUp, ArrowRight', keyHandleUpdown, false); //不生效 控制台不打印