From b74762a12a3f84d76660ab113fdd868ad297e711 Mon Sep 17 00:00:00 2001 From: "wanli.song@tusimple.ai" Date: Mon, 26 Jul 2021 15:15:17 +0800 Subject: [PATCH] fix(n-upload): prop v-model:file-list dosen't work well when prop multiple is true --- CHANGELOG.en-US.md | 6 ++++++ CHANGELOG.zh-CN.md | 6 ++++++ src/upload/src/Upload.tsx | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 69affd5da72..586c1782c00 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,5 +1,11 @@ # CHANGELOG +## Pending + +### Fixes + +- Fix `n-upload` prop `v-model:file-list` dosen't work well when prop `multiple` is `true`, closes [#418](https://github.com/TuSimple/naive-ui/issues/418). + ## 2.15.7 (2021-07-25) ### Feats diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index f36b4d6cd6c..6c9e61cf4fb 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,5 +1,11 @@ # CHANGELOG +## Pending + +### Fixes + +- 修复 `n-upload` 的 `v-model:file-list` 属性在 `multiple` 属性设为 `true` 的时候没有正确更新,关闭 [#418](https://github.com/TuSimple/naive-ui/issues/418) + ## 2.15.7 (2021-07-25) ### Feats diff --git a/src/upload/src/Upload.tsx b/src/upload/src/Upload.tsx index 98f9af0ccd5..3676aa61f16 100644 --- a/src/upload/src/Upload.tsx +++ b/src/upload/src/Upload.tsx @@ -387,7 +387,7 @@ export default defineComponent({ } ) => { const { append, remove } = options - const fileListAfterChange = Array.from(mergedFileListRef.value) + const { value: fileListAfterChange } = mergedFileListRef const fileIndex = fileListAfterChange.findIndex( (file) => file.id === fileAfterChange.id )