[fix] powerplan calling with black screen

This commit is contained in:
Purp1e
2025-03-22 21:44:27 +08:00
parent 446b26f186
commit ad5a1bd870
2 changed files with 9 additions and 3 deletions

View File

@@ -34,13 +34,13 @@ const PowerPlan = () => {
const tool = useToolStore()
const setPowerPlan = async (key: Key) => {
await tool.store.start()
const plan: number = Number(key)
const plan = Number(key)
await invoke("set_powerplan", { plan: plan })
const current = await invoke<number>("get_powerplan")
tool.setPowerPlan(current)
addToast({ title: "电源计划已切换 → " + PowerPlans[current].title })
addToast({ title: `电源计划已切换 → ${ PowerPlans[current].title}` })
}
const getPowerPlan = async (toast: boolean) => {
@@ -48,7 +48,7 @@ const PowerPlan = () => {
const current = await invoke<number>("get_powerplan")
tool.setPowerPlan(current)
if (toast) addToast({ title: "电源计划已切换 → " + PowerPlans[current].title })
if (toast) addToast({ title: `电源计划已切换 → ${ PowerPlans[current].title}` })
}
useEffect(() => {