Skip to content

Commit

Permalink
修复windows无限重启
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Dec 29, 2023
1 parent bd3a86f commit 4e8fdc2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/viewsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { appWindow } from "@tauri-apps/api/window";
import { invoke } from "@tauri-apps/api/tauri";

export function toggleTheme(darkTheme = false) {
export async function toggleTheme(darkTheme = false) {
document.body.setAttribute("arco-theme", darkTheme ? "dark" : "light");
try {
const theme = await invoke("plugin:theme|get_theme");
console.log(theme);
if (theme === (darkTheme ? "dark" : "light")) return;
invoke("plugin:theme|set_theme", {
theme: darkTheme ? "dark" : "light",
});
Expand Down

0 comments on commit 4e8fdc2

Please sign in to comment.