Skip to content

Commit 991fa77

Browse files
committed
fix: upload height error, close #5298
1 parent 55e0ad7 commit 991fa77

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

components/upload/UploadList/listAnimation.ts

+15-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { addClass, removeClass } from '../../vc-util/Dom/class';
22
import { nextTick } from 'vue';
33
import type { CSSMotionProps } from '../../_util/transition';
44

5-
const listAnimation = (name): CSSMotionProps => {
5+
const listAnimation = (name = 'ant-motion-collapse'): CSSMotionProps => {
66
return {
77
name,
88
appear: true,
99
css: true,
1010
onBeforeEnter: (node: HTMLDivElement) => {
11-
addClass(node, name);
1211
node.style.height = '0px';
1312
node.style.opacity = '0';
13+
addClass(node, name);
1414
},
1515
onEnter: (node: HTMLDivElement) => {
1616
nextTick(() => {
@@ -19,14 +19,16 @@ const listAnimation = (name): CSSMotionProps => {
1919
});
2020
},
2121
onAfterEnter: (node: HTMLDivElement) => {
22-
if (node) removeClass(node, name);
23-
node.style.height = undefined;
24-
node.style.opacity = undefined;
22+
if (node) {
23+
removeClass(node, name);
24+
node.style.height = null;
25+
node.style.opacity = null;
26+
}
2527
},
2628
onBeforeLeave: (node: HTMLDivElement) => {
2729
addClass(node, name);
2830
node.style.height = `${node.offsetHeight}px`;
29-
node.style.opacity = undefined;
31+
node.style.opacity = null;
3032
},
3133
onLeave: (node: HTMLDivElement) => {
3234
setTimeout(() => {
@@ -35,9 +37,13 @@ const listAnimation = (name): CSSMotionProps => {
3537
});
3638
},
3739
onAfterLeave: (node: HTMLDivElement) => {
38-
if (node) removeClass(node, name);
39-
node.style.height = undefined;
40-
node.style.opacity = undefined;
40+
if (node) {
41+
removeClass(node, name);
42+
if (node.style) {
43+
node.style.height = null;
44+
node.style.opacity = null;
45+
}
46+
}
4147
},
4248
};
4349
};

0 commit comments

Comments
 (0)