Commit 43769286 authored by 无木's avatar 无木

fix(upload): ensure preview items valid

parent 495b1da3
......@@ -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';
......@@ -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 }
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment