Skip to content

Commit

Permalink
重新刷新后,快捷键也好用了
Browse files Browse the repository at this point in the history
  • Loading branch information
testuser01 committed Dec 17, 2024
1 parent 050a881 commit b256367
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/views/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@
import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event";
import { useStorage } from "@vueuse/core";
import { ref, h, onMounted, onBeforeMount, onUnmounted } from "vue";
import { ref, h, onMounted, onUnmounted } from "vue";
import {
PlayCircleOutlined,
PauseCircleOutlined,
CloseOutlined,
} from "@ant-design/icons-vue";
import {
isRegistered,
register,
unregister,
unregisterAll,
} from "@tauri-apps/plugin-global-shortcut";
import { getCurrentWindow } from "@tauri-apps/api/window";
Expand Down Expand Up @@ -141,24 +141,33 @@ function handleStop() {
//invoke("stop_scan");
console.log("stop");
}
let unregisterAltQ:any;
let unregisterAltZ:any;
onMounted(async () => {
unregisterAltQ = await register("Alt+Q", (event) => {
if (await isRegistered("Alt+Q")) {
await unregister("Alt+Q");
}
if (await isRegistered("Alt+Z")) {
await unregister("Alt+Z");
}
await register("Alt+Q", (event) => {
if (event.state === "Pressed") {
handleStop();
handleScanLoop();
getCurrentWindow().hide();
}
});
unregisterAltZ = await register("Alt+Z", (event) => {
await register("Alt+Z", (event) => {
if (event.state === "Pressed") {
//handleScanLoop();
handleStop();
getCurrentWindow().show();
}
});
});
onUnmounted(async () => {
console.log("unmounted");
});
function deleteTask(index: number) {
startX.value.splice(index, 1);
endX.value.splice(index, 1);
Expand Down

0 comments on commit b256367

Please sign in to comment.