@@ -39,9 +39,25 @@ export default defineComponent({
39
39
measureStretchStyle ( props . getRootDomNode ( ) ) ;
40
40
}
41
41
} ;
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
+ ) ;
42
58
43
59
// ======================== Status ========================
44
- const [ status , goNextStatus ] = useVisibleStatus ( toRef ( props , ' visible' ) , doMeasure ) ;
60
+ const [ status , goNextStatus ] = useVisibleStatus ( visible , doMeasure ) ;
45
61
46
62
// ======================== Aligns ========================
47
63
const prepareResolveRef = ref < ( value ?: unknown ) => void > ( ) ;
@@ -117,7 +133,6 @@ export default defineComponent({
117
133
return ( ) => {
118
134
const {
119
135
zIndex,
120
- visible,
121
136
align,
122
137
prefixCls,
123
138
destroyPopupOnHide,
@@ -131,7 +146,8 @@ export default defineComponent({
131
146
const mergedStyle : CSSProperties = {
132
147
...stretchStyle . value ,
133
148
zIndex,
134
- opacity : statusValue === 'motion' || statusValue === 'stable' || ! visible ? undefined : 0 ,
149
+ opacity :
150
+ statusValue === 'motion' || statusValue === 'stable' || ! visible . value ? undefined : 0 ,
135
151
pointerEvents : statusValue === 'stable' ? undefined : 'none' ,
136
152
...( attrs . style as object ) ,
137
153
} ;
@@ -149,17 +165,18 @@ export default defineComponent({
149
165
childNode = < div class = { `${ prefixCls } -content` } > { childNode } </ div > ;
150
166
}
151
167
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 ) : { } ;
153
170
return (
154
171
< Transition
155
172
ref = { elementRef }
156
173
{ ...transitionProps }
157
174
onBeforeEnter = { onShowPrepare }
158
175
v-slots = { {
159
176
default : ( ) => {
160
- return ! destroyPopupOnHide || visible ? (
177
+ return ! destroyPopupOnHide || props . visible ? (
161
178
< Align
162
- v-show = { visible }
179
+ v-show = { visible . value }
163
180
target = { getAlignTarget ( ) }
164
181
key = "popup"
165
182
ref = { alignRef }
0 commit comments