fix(upload): ensure the value type is correct

修复BasicUpload组件在设置null值时的问题
This commit is contained in:
无木 2021-07-09 00:22:00 +08:00
parent 7b76945bff
commit 05329ce950
3 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@
- 新增`headerTop`插槽
- **AppSearch** 修复可能会搜索隐藏菜单的问题
- **TableAction** 仅在 action.tooltip 存在的情况下 才包裹 Tooltip 组件
- **BasicUpload** 修复处理非`array`值时报错的问题
- **其它**
- 修复菜单默认折叠的配置不起作用的问题
- 修复`safari`浏览器报错导致网站打不开

View File

@ -46,6 +46,7 @@
import { uploadContainerProps } from './props';
import { omit } from 'lodash-es';
import { useI18n } from '/@/hooks/web/useI18n';
import { isArray } from '/@/utils/is';
export default defineComponent({
name: 'BasicUpload',
@ -77,7 +78,7 @@
watch(
() => props.value,
(value = []) => {
fileList.value = value;
fileList.value = isArray(value) ? value : [];
},
{ immediate: true }
);

View File

@ -20,6 +20,7 @@
import { downloadByUrl } from '/@/utils/file/download';
import { createPreviewColumns, createPreviewActionColumn } from './data';
import { useI18n } from '/@/hooks/web/useI18n';
import { isArray } from '/@/utils/is';
export default defineComponent({
components: { BasicModal, FileList },
@ -33,6 +34,7 @@
watch(
() => props.value,
(value) => {
if (!isArray(value)) value = [];
fileListRef.value = value
.filter((item) => !!item)
.map((item) => {