Skip to content

Commit

Permalink
fix(upload): ensure preview items valid
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetfan committed Jun 5, 2021
1 parent 495b1da commit 4376928
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/components/Upload/src/UploadPreviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</BasicModal>
</template>
<script lang="ts">
import { defineComponent, watch, ref, unref } from 'vue';
import { defineComponent, watch, ref } from 'vue';
// import { BasicTable, useTable } from '/@/components/Table';
import FileList from './FileList';
Expand All @@ -36,17 +36,15 @@
watch(
() => props.value,
(value) => {
fileListRef.value = [];
value.forEach((item) => {
fileListRef.value = [
...unref(fileListRef),
{
fileListRef.value = value
.filter((item) => !!item)
.map((item) => {
return {
url: item,
type: item.split('.').pop() || '',
name: item.split('/').pop() || '',
},
];
});
};
});
},
{ immediate: true }
);
Expand Down

0 comments on commit 4376928

Please sign in to comment.