feat: 文件上传查询不到ossId的丢弃策略
This commit is contained in:
parent
b3e2d758f6
commit
69222807a4
@ -249,7 +249,19 @@ export function useUpload(
|
||||
};
|
||||
return fileitem;
|
||||
}
|
||||
innerFileList.value = resp.map((item) => transformFile(item));
|
||||
const transformOptions = resp.map((item) => transformFile(item));
|
||||
innerFileList.value = transformOptions;
|
||||
// 单文件 丢弃策略
|
||||
if (props.maxCount === 1 && resp.length === 0 && !props.keepMissingId) {
|
||||
bindValue.value = '';
|
||||
return;
|
||||
}
|
||||
// 多文件
|
||||
if (resp.length !== value.length && !props.keepMissingId) {
|
||||
bindValue.value = (bindValue.value as string[]).filter((ossId) =>
|
||||
resp.map((res) => res.ossId).includes(ossId),
|
||||
);
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: props.deepWatch },
|
||||
);
|
||||
|
@ -66,4 +66,10 @@ export interface BaseUploadProps {
|
||||
* @default false
|
||||
*/
|
||||
deepWatch?: boolean;
|
||||
/**
|
||||
* 当ossId查询不到文件信息时 比如被删除了
|
||||
* 是否保留列表对应的ossId 默认不保留
|
||||
* @default false
|
||||
*/
|
||||
keepMissingId?: boolean;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user