@@ -10,15 +10,16 @@ import Button from '../../button';
10
10
import ListItem from './ListItem' ;
11
11
import type { HTMLAttributes } from 'vue' ;
12
12
import { computed , defineComponent , getCurrentInstance , onMounted , ref , watchEffect } from 'vue' ;
13
- import { initDefaultProps , isValidElement } from '../../_util/props-util' ;
13
+ import { filterEmpty , initDefaultProps , isValidElement } from '../../_util/props-util' ;
14
14
import type { VueNode } from '../../_util/type' ;
15
15
import useConfigInject from '../../_util/hooks/useConfigInject' ;
16
16
import { getTransitionGroupProps , TransitionGroup } from '../../_util/transition' ;
17
17
import collapseMotion from '../../_util/collapseMotion' ;
18
18
19
19
const HackSlot = ( _ , { slots } ) => {
20
- return slots . default ?.( ) [ 0 ] ;
20
+ return filterEmpty ( slots . default ?.( ) ) [ 0 ] ;
21
21
} ;
22
+
22
23
export default defineComponent ( {
23
24
name : 'AUploadList' ,
24
25
props : initDefaultProps ( uploadListProps ( ) , {
@@ -166,11 +167,11 @@ export default defineComponent({
166
167
previewIcon,
167
168
downloadIcon,
168
169
progress,
169
- appendAction = slots . appendAction ,
170
+ appendAction,
170
171
itemRender,
171
172
appendActionVisible,
172
173
} = props ;
173
- const appendActionDom = appendAction ?.( ) [ 0 ] ;
174
+ const appendActionDom = appendAction ?.( ) ;
174
175
return (
175
176
< TransitionGroup { ...transitionGroupProps . value } tag = "div" >
176
177
{ items . map ( file => {
@@ -203,8 +204,12 @@ export default defineComponent({
203
204
/>
204
205
) ;
205
206
} ) }
206
- { appendActionVisible && isValidElement ( appendActionDom ) ? (
207
- < HackSlot key = "__ant_upload_appendAction" > { appendActionDom } </ HackSlot >
207
+ { appendAction ? (
208
+ < HackSlot
209
+ key = "__ant_upload_appendAction"
210
+ v-show = { ! ! appendActionVisible }
211
+ v-slots = { { default : ( ) => appendActionDom } }
212
+ > </ HackSlot >
208
213
) : null }
209
214
</ TransitionGroup >
210
215
) ;
0 commit comments