一、项目地址
https://github.com/Mitscherlich/vue-use-hotkeys
二、使用
$ pnpm add vue-use-hotkeys
# or
$ yarn add vue-use-hotkeys
# or
$ npm i -S vue-use-hotkeys
三、操作示例
import { defineComponent, ref } from 'vue';
import { useHotkeys } from 'vue-use-hotkeys';
export default defineComponent(() => {
const count = ref(0);
useHotKeys('ctrl + k', () => {
count.value += 1;
});
return () => (
<p>
Pressed <kbd>ctrl + k</kbd> {count.value} times.
</p>
);
});