-
-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
快捷键 上下左右的时候 无响应 #431
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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); //不生效 控制台不打印
The text was updated successfully, but these errors were encountered: