diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index f6663b41a3154cee20bb50c5f7f3fdf1d3c17305..4d82ede0280addb8443f7b91ee126b7ac41d6bbb 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -18,6 +18,7 @@ - **PageWrapper** 修复高度计算问题 - **FlowChart** 修复拖放菜单丢失 - 修复后台模式下,Iframe 路由错误 +- **PageWrapper** 修复 footer 与全局页脚同时开启时的高度计算问题 ## 2.4.2(2021-06-10) diff --git a/src/components/Page/src/PageWrapper.vue b/src/components/Page/src/PageWrapper.vue index 583e1369d484a6149eb3087365277ec185c6d4a4..d5e9aaba48e0b2455a256c1eb27248736a11014b 100644 --- a/src/components/Page/src/PageWrapper.vue +++ b/src/components/Page/src/PageWrapper.vue @@ -96,7 +96,6 @@ ...contentStyle, minHeight: height, ...(fixedHeight ? { height } : {}), - paddingBottom: `${unref(footerHeight)}px`, }; }); @@ -166,7 +165,36 @@ const contentMarginTop = Number(marginTop.replace(/[^\d]/g, '')); subtractHeight += contentMarginTop; } - setPageHeight?.(unref(contentHeight) - unref(footerHeight) - headerHeight - subtractHeight); + + // fix: wrapper marginTop and marginBottom value + let wrapperSubtractHeight = 0; + let wrapperMarginBottom = ZERO_PX; + let wrapperMarginTop = ZERO_PX; + const wrapperClassElments = document.querySelectorAll(`.${prefixVar}-page-wrapper`); + if (wrapperClassElments && wrapperClassElments.length > 0) { + const contentEl = wrapperClassElments[0]; + const cssStyle = getComputedStyle(contentEl); + wrapperMarginBottom = cssStyle?.marginBottom ?? ZERO_PX; + wrapperMarginTop = cssStyle?.marginTop ?? ZERO_PX; + } + if (wrapperMarginBottom) { + const contentMarginBottom = Number(wrapperMarginBottom.replace(/[^\d]/g, '')); + wrapperSubtractHeight += contentMarginBottom; + } + if (wrapperMarginTop) { + const contentMarginTop = Number(wrapperMarginTop.replace(/[^\d]/g, '')); + wrapperSubtractHeight += contentMarginTop; + } + let height = + unref(contentHeight) - + unref(footerHeight) - + headerHeight - + subtractHeight - + wrapperSubtractHeight; + if (unref(getShowFooter)) { + height -= unref(footerHeightRef); + } + setPageHeight?.(height); } return { diff --git a/src/layouts/default/footer/index.vue b/src/layouts/default/footer/index.vue index 7cd2b24d8a3cf0e2d92978e44ab99585a4265f73..62e3c5e98f1c68a6e7fa6158ae08c2c789f6ff25 100644 --- a/src/layouts/default/footer/index.vue +++ b/src/layouts/default/footer/index.vue @@ -1,5 +1,5 @@