🐛 Fix(custom): fix theme update func

This commit is contained in:
Kuingsmile
2026-01-20 07:49:19 +08:00
parent f129018362
commit 0bf1e2b6d9
9 changed files with 102 additions and 556 deletions

View File

@@ -1862,7 +1862,7 @@ import {
import { marked } from 'marked'
import type { IConfig } from 'piclist'
import pkg from 'root/package.json'
import { computed, onBeforeMount, reactive, ref, toRaw, watch } from 'vue'
import { computed, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, toRaw, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
@@ -2190,6 +2190,19 @@ onBeforeMount(() => {
initData()
})
let unbindTheme: () => void
onMounted(() => {
unbindTheme = window.electron.onThemeUpdate((_: string) => {
console.log('Applying theme CSS update:')
})
})
onBeforeUnmount(() => {
if (unbindTheme) {
unbindTheme()
}
})
async function loadThemes() {
try {
const themes = await window.electron.triggerRPC<{ key: string; label: string }[]>(