fix(接口测试): 响应体切换时 binary 文件未更新修复
This commit is contained in:
parent
afb7b0569e
commit
494bb58e67
|
@ -245,6 +245,9 @@
|
|||
.filter((item) => !item?.local)
|
||||
.map((item) => item?.[props.fields.id] || '')
|
||||
.filter((item) => item);
|
||||
} else {
|
||||
inputFileName.value = '';
|
||||
inputFiles.value = [];
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -489,9 +489,22 @@
|
|||
onBeforeMount(() => {
|
||||
if (activeResponse.value.body.binaryBody && activeResponse.value.body.binaryBody.file) {
|
||||
fileList.value = [activeResponse.value.body.binaryBody.file as unknown as MsFileItem];
|
||||
} else {
|
||||
fileList.value = [];
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => activeResponse.value.id,
|
||||
() => {
|
||||
if (activeResponse.value.body.binaryBody && activeResponse.value.body.binaryBody.file) {
|
||||
fileList.value = [activeResponse.value.body.binaryBody.file as unknown as MsFileItem];
|
||||
} else {
|
||||
fileList.value = [];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
async function handleFileChange() {
|
||||
try {
|
||||
if (fileList.value[0] && fileList.value[0].local && fileList.value[0].file && props.uploadTempFileApi) {
|
||||
|
@ -509,7 +522,7 @@
|
|||
activeResponse.value.body.binaryBody.file = {
|
||||
...fileList.value[0],
|
||||
fileId: fileList.value[0].uid,
|
||||
fileName: fileList.value[0]?.originalName || '',
|
||||
fileName: fileList.value[0]?.name || '',
|
||||
fileAlias: fileList.value[0]?.name || '',
|
||||
local: false,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue