mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 21:24:05 +02:00
refactor(keyboard): optimize keyboard event handling and initialization
This commit is contained in:
parent
c3b31bdde6
commit
a5fbea31a1
3 changed files with 117 additions and 110 deletions
18
app.vue
18
app.vue
|
@ -6,18 +6,28 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { app, window } from "@tauri-apps/api";
|
||||
import { window } from "@tauri-apps/api";
|
||||
import { disable, enable } from "@tauri-apps/plugin-autostart";
|
||||
import { onMounted } from "vue";
|
||||
import { keyboard } from "wrdu-keyboard";
|
||||
|
||||
const keyboard = useKeyboard();
|
||||
const { $settings } = useNuxtApp();
|
||||
const router = useRouter();
|
||||
keyboard.init();
|
||||
|
||||
router.beforeEach((to, from) => {
|
||||
if (to.path !== from.path) {
|
||||
keyboard.init();
|
||||
}
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
keyboard.clear();
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await listen("settings", async () => {
|
||||
keyboard.clear();
|
||||
await navigateTo("/settings");
|
||||
await app.show();
|
||||
await window.getCurrentWindow().show();
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue