From 5fa80d3c5eb9d8234625116045af48aac51ebb7c Mon Sep 17 00:00:00 2001 From: Ryan2128 <33176053+Ryan2128@users.noreply.github.com> Date: Thu, 10 Dec 2020 11:05:13 +0800 Subject: [PATCH] Fix/upload: fix two bug (#927) * fix(upload): fix picture not show without slot * fix(upload): fix fileList not work --- packages/upload/src/index.vue | 13 +++++-------- packages/upload/src/useHandlers.ts | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/upload/src/index.vue b/packages/upload/src/index.vue index 4ca232ef3e..e79310e768 100644 --- a/packages/upload/src/index.vue +++ b/packages/upload/src/index.vue @@ -190,16 +190,13 @@ export default defineComponent({ onRemove: this.handleRemove, handlePreview: this.onPreview, }, - { + this.$slots.file ? { default: (props: { file: UploadFile; }) => { - if (this.$slots.file) { - return this.$slots.file({ - file: props.file, - }) - } - return null + return this.$slots.file({ + file: props.file, + }) }, - }, + } : null, ) } else { uploadList = null diff --git a/packages/upload/src/useHandlers.ts b/packages/upload/src/useHandlers.ts index 64f6fe5846..f19e36c45d 100644 --- a/packages/upload/src/useHandlers.ts +++ b/packages/upload/src/useHandlers.ts @@ -135,6 +135,7 @@ export default (props: IUseHandlersProps) => { }) }, { immediate: true, + deep: true, }) return {