Skip to content
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

Open
wedjava opened this issue Jun 14, 2023 · 0 comments
Open

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

wedjava opened this issue Jun 14, 2023 · 0 comments

Comments

@wedjava
Copy link

wedjava commented Jun 14, 2023

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); //不生效 控制台不打印

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant