feat: 全局热键监听10%

pull/1/head
刘释隆 1 year ago
parent b1aef1743f
commit fd11c4f323

@ -3,6 +3,11 @@ import { dateZhCN, zhCN } from "naive-ui";
import { computed, onMounted, nextTick } from "vue"; import { computed, onMounted, nextTick } from "vue";
import { AppProvider } from "@/components/Application"; import { AppProvider } from "@/components/Application";
import { lighten } from "@/utils/index"; import { lighten } from "@/utils/index";
import mouseTrapBind from '@/hooks/event/mouseTrapBind'
onMounted(()=>{
mouseTrapBind();
})
const getThemeOverrides = computed(() => { const getThemeOverrides = computed(() => {
const theme = "#1980FF"; const theme = "#1980FF";

@ -0,0 +1,14 @@
import { inject } from 'vue'
const mousetrap = inject('mousetrap') as any
const commonKeyDown = (keyCode: number) => {
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode }));
}
const c = () => {
commonKeyDown(27)
}
const initBind = () => {
mousetrap.bind('c', c)
}
export default initBind;
Loading…
Cancel
Save