fix: 用来标识是否为上传 这样在watch内部不需要请求api
This commit is contained in:
parent
89dd4b8131
commit
9f978cc9b0
@ -160,6 +160,8 @@ export function useUpload(
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 用来标识是否为上传 这样在watch内部不需要请求api
|
||||||
|
let isUpload = false;
|
||||||
function handleChange(info: UploadChangeParam) {
|
function handleChange(info: UploadChangeParam) {
|
||||||
/**
|
/**
|
||||||
* 移除当前文件
|
* 移除当前文件
|
||||||
@ -199,7 +201,8 @@ export function useUpload(
|
|||||||
currentFile.fileName = transformFilename(cb);
|
currentFile.fileName = transformFilename(cb);
|
||||||
currentFile.name = transformFilename(cb);
|
currentFile.name = transformFilename(cb);
|
||||||
currentFile.thumbUrl = transformThumbUrl(cb);
|
currentFile.thumbUrl = transformThumbUrl(cb);
|
||||||
|
// 标记为上传 watch根据值做处理
|
||||||
|
isUpload = true;
|
||||||
// ossID添加 单个文件会被当做string
|
// ossID添加 单个文件会被当做string
|
||||||
if (props.maxCount === 1) {
|
if (props.maxCount === 1) {
|
||||||
bindValue.value = ossId;
|
bindValue.value = ossId;
|
||||||
@ -321,6 +324,14 @@ export function useUpload(
|
|||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 上传完毕 不需要调用获取信息接口
|
||||||
|
if (isUpload) {
|
||||||
|
// 清理 使下一次状态可用
|
||||||
|
isUpload = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const resp = await ossInfo(value);
|
const resp = await ossInfo(value);
|
||||||
function transformFile(info: OssFile) {
|
function transformFile(info: OssFile) {
|
||||||
const cb = { type: 'info', response: info } as const;
|
const cb = { type: 'info', response: info } as const;
|
||||||
|
Loading…
Reference in New Issue
Block a user