fix: 单文件查询到会走多文件的判断

This commit is contained in:
dap 2025-03-31 10:47:30 +08:00
parent bc9e3a50e1
commit c0a5942c2a
2 changed files with 7 additions and 2 deletions

View File

@ -337,7 +337,12 @@ export function useUpload(
return;
}
// 多文件
if (resp.length !== value.length && !props.keepMissingId) {
// 单文件查到了也会走这里的逻辑 filter会报错 需要maxCount判断处理
if (
resp.length !== value.length &&
!props.keepMissingId &&
props.maxCount !== 1
) {
bindValue.value = (bindValue.value as string[]).filter((ossId) =>
resp.map((res) => res.ossId).includes(ossId),
);

View File

@ -16,7 +16,7 @@ import { useFileType, useImageType } from './hook';
import sql from './insert.sql?raw';
const singleImageId = ref('1905537674682916865');
const singleFileId = ref('1906520520833949698');
const singleFileId = ref('1905191167882518529');
const multipleImageId = ref<string[]>(['1905537674682916865']);
const multipleFileId = ref<string[]>(['1905191167882518529']);