@@ -10,15 +10,16 @@ import Button from '../../button';
1010import ListItem from './ListItem' ;
1111import type { HTMLAttributes } from 'vue' ;
1212import { 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' ;
1414import type { VueNode } from '../../_util/type' ;
1515import useConfigInject from '../../_util/hooks/useConfigInject' ;
1616import { getTransitionGroupProps , TransitionGroup } from '../../_util/transition' ;
1717import collapseMotion from '../../_util/collapseMotion' ;
1818
1919const HackSlot = ( _ , { slots } ) => {
20- return slots . default ?.( ) [ 0 ] ;
20+ return filterEmpty ( slots . default ?.( ) ) [ 0 ] ;
2121} ;
22+
2223export default defineComponent ( {
2324 name : 'AUploadList' ,
2425 props : initDefaultProps ( uploadListProps ( ) , {
@@ -166,11 +167,11 @@ export default defineComponent({
166167 previewIcon,
167168 downloadIcon,
168169 progress,
169- appendAction = slots . appendAction ,
170+ appendAction,
170171 itemRender,
171172 appendActionVisible,
172173 } = props ;
173- const appendActionDom = appendAction ?.( ) [ 0 ] ;
174+ const appendActionDom = appendAction ?.( ) ;
174175 return (
175176 < TransitionGroup { ...transitionGroupProps . value } tag = "div" >
176177 { items . map ( file => {
@@ -203,8 +204,12 @@ export default defineComponent({
203204 />
204205 ) ;
205206 } ) }
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 >
208213 ) : null }
209214 </ TransitionGroup >
210215 ) ;
0 commit comments