|
|
@@ -35,6 +35,19 @@ const Home = () => {
|
|
|
}
|
|
|
setHomePageContent(content);
|
|
|
localStorage.setItem('home_page_content', content);
|
|
|
+
|
|
|
+ // 如果内容是 URL,则发送主题模式
|
|
|
+ if (data.startsWith('https://')) {
|
|
|
+ const iframe = document.querySelector('iframe');
|
|
|
+ if (iframe) {
|
|
|
+ const theme = localStorage.getItem('theme-mode') || 'light';
|
|
|
+ // 测试是否正确传递theme-mode给iframe
|
|
|
+ // console.log('Sending theme-mode to iframe:', theme);
|
|
|
+ iframe.onload = () => {
|
|
|
+ iframe.contentWindow.postMessage({ themeMode: theme }, '*');
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
showError(message);
|
|
|
setHomePageContent('加载首页内容失败...');
|