@@ -39,9 +39,25 @@ export default defineComponent({
3939 measureStretchStyle ( props . getRootDomNode ( ) ) ;
4040 }
4141 } ;
42+ const visible = ref ( false ) ;
43+ let timeoutId : any ;
44+ watch (
45+ ( ) => props . visible ,
46+ val => {
47+ clearTimeout ( timeoutId ) ;
48+ if ( val ) {
49+ timeoutId = setTimeout ( ( ) => {
50+ visible . value = props . visible ;
51+ } ) ;
52+ } else {
53+ visible . value = false ;
54+ }
55+ } ,
56+ { immediate : true } ,
57+ ) ;
4258
4359 // ======================== Status ========================
44- const [ status , goNextStatus ] = useVisibleStatus ( toRef ( props , ' visible' ) , doMeasure ) ;
60+ const [ status , goNextStatus ] = useVisibleStatus ( visible , doMeasure ) ;
4561
4662 // ======================== Aligns ========================
4763 const prepareResolveRef = ref < ( value ?: unknown ) => void > ( ) ;
@@ -117,7 +133,6 @@ export default defineComponent({
117133 return ( ) => {
118134 const {
119135 zIndex,
120- visible,
121136 align,
122137 prefixCls,
123138 destroyPopupOnHide,
@@ -131,7 +146,8 @@ export default defineComponent({
131146 const mergedStyle : CSSProperties = {
132147 ...stretchStyle . value ,
133148 zIndex,
134- opacity : statusValue === 'motion' || statusValue === 'stable' || ! visible ? undefined : 0 ,
149+ opacity :
150+ statusValue === 'motion' || statusValue === 'stable' || ! visible . value ? undefined : 0 ,
135151 pointerEvents : statusValue === 'stable' ? undefined : 'none' ,
136152 ...( attrs . style as object ) ,
137153 } ;
@@ -149,17 +165,18 @@ export default defineComponent({
149165 childNode = < div class = { `${ prefixCls } -content` } > { childNode } </ div > ;
150166 }
151167 const mergedClassName = classNames ( prefixCls , attrs . class , alignedClassName . value ) ;
152- const transitionProps = getTransitionProps ( motion . value . name , motion . value ) ;
168+ const hasAnimate = visible . value || ! props . visible ;
169+ const transitionProps = hasAnimate ? getTransitionProps ( motion . value . name , motion . value ) : { } ;
153170 return (
154171 < Transition
155172 ref = { elementRef }
156173 { ...transitionProps }
157174 onBeforeEnter = { onShowPrepare }
158175 v-slots = { {
159176 default : ( ) => {
160- return ! destroyPopupOnHide || visible ? (
177+ return ! destroyPopupOnHide || props . visible ? (
161178 < Align
162- v-show = { visible }
179+ v-show = { visible . value }
163180 target = { getAlignTarget ( ) }
164181 key = "popup"
165182 ref = { alignRef }
0 commit comments