This commit is contained in:
2026-02-02 16:41:35 +08:00
parent 3684116b2d
commit 5685341ac4

View File

@@ -1333,9 +1333,20 @@ watch(() => categoryTreeData.value, () => {
// 初始化 // 初始化
onMounted(async () => { onMounted(async () => {
// 检测是否在 iframe 中,如果是,则修改 #app 的 overflow 样式以支持滚动 // 检测是否在 iframe 中,如果是,则修改相关元素的 overflow 样式以支持滚动
if (window.parent !== window) { if (window.parent !== window) {
nextTick(() => { nextTick(() => {
// 修改 html 和 body
document.documentElement.style.overflow = 'auto';
document.documentElement.style.height = 'auto';
document.body.style.overflow = 'auto';
document.body.style.height = 'auto';
// 修改 html 和 body添加类名
document.documentElement.classList.add('iframe-mode');
document.body.classList.add('iframe-mode');
// 修改 #app
const app = document.getElementById('app'); const app = document.getElementById('app');
if (app) { if (app) {
app.style.overflow = 'auto'; app.style.overflow = 'auto';
@@ -1397,11 +1408,25 @@ onMounted(async () => {
</style> </style>
<style> <style>
/* 当页面在 iframe 中时,允许 #app 滚动 */ /* 当页面在 iframe 中时,允许滚动 */
html.iframe-mode,
body.iframe-mode {
overflow: auto !important;
height: 100% !important;
min-height: 100% !important;
}
#app.iframe-mode { #app.iframe-mode {
overflow: auto !important; overflow: auto !important;
height: auto !important; height: auto !important;
min-height: 100% !important; min-height: 100% !important;
} }
/* 在 iframe 模式下,修改页面容器样式 */
.iframe-mode .modern-page-container {
min-height: auto !important;
height: auto !important;
overflow: visible !important;
}
</style> </style>