Files
auv/index.html
T
2026-07-05 21:29:17 +08:00

57 lines
1.7 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>A股历史走势追踪</title>
<style>
/* 内联样式确保主题色立即生效,避免闪烁 */
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
html.light, html.light body {
background-color: #ffffff !important;
color: #000000;
}
html.dark, html.dark body {
background-color: #1a1a1a !important;
color: #ffffff;
}
</style>
<script>
// 在 React 加载前立即设置主题,避免闪烁
(function() {
const isInIframe = window.self !== window.top;
function applyThemeToDOM(theme) {
document.documentElement.classList.remove('light', 'dark');
document.documentElement.classList.add(theme);
document.documentElement.setAttribute('data-theme', theme);
}
if (isInIframe) {
// 监听父窗口主动推送的主题消息
window.addEventListener('message', function(event) {
if (event.data && typeof event.data.theme === 'string') {
var theme = event.data.theme;
if (theme === 'light' || theme === 'dark') {
applyThemeToDOM(theme);
}
}
});
} else {
// 非 iframe 环境,使用默认 light 主题
applyThemeToDOM('light');
}
})();
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>