diff --git a/src/views/dialogue/components/TitleBar.vue b/src/views/dialogue/components/TitleBar.vue index d3d55166e859da5ba82076cc86074c23b8d3789c..0e2707b268096fb564ddd85565e5059d94ffe076 100644 --- a/src/views/dialogue/components/TitleBar.vue +++ b/src/views/dialogue/components/TitleBar.vue @@ -45,7 +45,17 @@ const { theme } = storeToRefs(useChangeThemeStore()); const changeTheme = () => { const { updateTheme } = useChangeThemeStore(); - updateTheme(theme.value === 'light' ? 'dark' : 'light'); + const newTheme = theme.value === 'light' ? 'dark' : 'light'; + updateTheme(newTheme); + // 同步主题到iframe + const iframe = document.querySelector('#my-iframe'); + if (iframe?.contentWindow) { + const data = { + theme: newTheme, + type: 'changeTheme', + }; + iframe.contentWindow.postMessage(data, iframeTarget.value); + } }; const logoutHandler = () => {