@@ -58,10 +58,6 @@ const SubAccordion: FC<SubMenuWithCustomizeProps> = (props) => {
5858 } ) ,
5959 ) ;
6060
61- const childStyle = {
62- maxHeight : isExpand ? undefined : 0 ,
63- } ;
64-
6561 // 是否展开(popup 与 expand 两种状态)
6662 const isOpen = useMemo ( ( ) => {
6763 if ( disabled ) return false ;
@@ -78,16 +74,24 @@ const SubAccordion: FC<SubMenuWithCustomizeProps> = (props) => {
7874
7975 const transitionCallbacks = {
8076 onEnter : ( ) => {
77+ contentRef . current . style . height = '0px' ;
78+ contentRef . current . style . maxHeight = '0px' ;
79+ } ,
80+ onEntering : ( ) => {
8181 contentRef . current . style . height = `${ contentRef ?. current . scrollHeight } px` ;
82+ contentRef . current . style . maxHeight = `${ contentRef ?. current . scrollHeight } px` ;
8283 } ,
8384 onEntered : ( ) => {
8485 contentRef . current . style . height = 'auto' ;
86+ contentRef . current . style . maxHeight = 'none' ;
8587 } ,
8688 onExit : ( ) => {
8789 contentRef . current . style . height = `${ contentRef ?. current . scrollHeight } px` ;
90+ contentRef . current . style . maxHeight = `${ contentRef ?. current . scrollHeight } px` ;
8891 } ,
8992 onExiting : ( ) => {
9093 contentRef . current . style . height = '0px' ;
94+ contentRef . current . style . maxHeight = '0px' ;
9195 } ,
9296 } ;
9397
@@ -97,7 +101,6 @@ const SubAccordion: FC<SubMenuWithCustomizeProps> = (props) => {
97101 [ `${ classPrefix } -is-opened` ] : isOpen ,
98102 } ) }
99103 key = "popup"
100- style = { childStyle }
101104 >
102105 { popupChildren }
103106 </ ul >
@@ -128,7 +131,6 @@ const SubAccordion: FC<SubMenuWithCustomizeProps> = (props) => {
128131 key = "normal"
129132 style = {
130133 {
131- ...childStyle ,
132134 '--padding-left' : `${ menuPaddingLeft } px` ,
133135 overflow : 'hidden' ,
134136 } as React . CSSProperties
0 commit comments