@ -45,6 +45,7 @@
import { propTypes } from '/@/utils/propTypes' ;
import { omit } from 'lodash-es' ;
import { PageHeader } from 'ant-design-vue' ;
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated' ;
export default defineComponent ( {
name : 'PageWrapper' ,
components : { PageFooter , PageHeader } ,
@ -105,41 +106,7 @@
watch (
( ) => [ contentHeight ? . value , getShowFooter . value ] ,
( ) => {
if ( ! props . contentFullHeight ) {
return ;
}
nextTick ( ( ) => {
/ / f i x : i n c o n t e n t H e i g h t m o d e : d e l a y g e t t i n g f o o t e r a n d h e a d e r d o m e l e m e n t t o g e t t h e c o r r e c t h e i g h t
const footer = unref ( footerRef ) ;
const header = unref ( headerRef ) ;
footerHeight . value = 0 ;
const footerEl = footer ? . $el ;
if ( footerEl ) {
footerHeight . value += footerEl ? . offsetHeight ? ? 0 ;
}
let headerHeight = 0 ;
const headerEl = header ? . $el ;
if ( headerEl ) {
headerHeight += headerEl ? . offsetHeight ? ? 0 ;
}
/ / f i x : s u b t r a c t c o n t e n t ' s m a r g i n T o p a n d m a r g i n B o t t o m v a l u e
let subtractHeight = 0 ;
const { marginBottom , marginTop } = getComputedStyle (
document . querySelectorAll ( ` . ${ prefixVar } -page-wrapper-content ` ) ? . [ 0 ]
) ;
if ( marginBottom ) {
const contentMarginBottom = Number ( marginBottom . replace ( /[^\d]/g , '' ) ) ;
subtractHeight += contentMarginBottom ;
}
if ( marginTop ) {
const contentMarginTop = Number ( marginTop . replace ( /[^\d]/g , '' ) ) ;
subtractHeight += contentMarginTop ;
}
setPageHeight ? . (
unref ( contentHeight ) - unref ( footerHeight ) - headerHeight - subtractHeight
) ;
} ) ;
calcContentHeight ( ) ;
} ,
{
flush : 'post' ,
@ -147,6 +114,52 @@
}
) ;
onMountedOrActivated ( ( ) => {
nextTick ( ( ) => {
calcContentHeight ( ) ;
} ) ;
} ) ;
function calcContentHeight ( ) {
if ( ! props . contentFullHeight ) {
return ;
}
/ / f i x : i n c o n t e n t H e i g h t m o d e : d e l a y g e t t i n g f o o t e r a n d h e a d e r d o m e l e m e n t t o g e t t h e c o r r e c t h e i g h t
const footer = unref ( footerRef ) ;
const header = unref ( headerRef ) ;
footerHeight . value = 0 ;
const footerEl = footer ? . $el ;
if ( footerEl ) {
footerHeight . value += footerEl ? . offsetHeight ? ? 0 ;
}
let headerHeight = 0 ;
const headerEl = header ? . $el ;
if ( headerEl ) {
headerHeight += headerEl ? . offsetHeight ? ? 0 ;
}
/ / f i x : s u b t r a c t c o n t e n t ' s m a r g i n T o p a n d m a r g i n B o t t o m v a l u e
let subtractHeight = 0 ;
let marginBottom = '0px' ;
let marginTop = '0px' ;
const classElments = document . querySelectorAll ( ` . ${ prefixVar } -page-wrapper-content ` ) ;
if ( classElments && classElments . length > 0 ) {
const contentEl = classElments [ 0 ] ;
const cssStyle = getComputedStyle ( contentEl ) ;
marginBottom = cssStyle ? . marginBottom ;
marginTop = cssStyle ? . marginTop ;
}
if ( marginBottom ) {
const contentMarginBottom = Number ( marginBottom . replace ( /[^\d]/g , '' ) ) ;
subtractHeight += contentMarginBottom ;
}
if ( marginTop ) {
const contentMarginTop = Number ( marginTop . replace ( /[^\d]/g , '' ) ) ;
subtractHeight += contentMarginTop ;
}
setPageHeight ? . ( unref ( contentHeight ) - unref ( footerHeight ) - headerHeight - subtractHeight ) ;
}
return {
getContentStyle ,
footerRef ,