forked from dyf/dyf-vue-ui
修复设备列表,编辑时,不修改图片不需要传file字段
This commit is contained in:
@ -737,11 +737,12 @@ const submitForm = async () => {
|
||||
// 处理图片字段
|
||||
if (form.value.image instanceof File) {
|
||||
formData.append('file', form.value.image);
|
||||
} else if (form.value.image && typeof form.value.image === 'string') {
|
||||
// 如果是URL且需要转换为二进制
|
||||
const blob = await urlToBlob(form.value.image);
|
||||
formData.append('file', blob, 'image.jpg'); // 添加文件名
|
||||
}
|
||||
// else if (form.value.image && typeof form.value.image === 'string') {
|
||||
// // 如果是URL且需要转换为二进制
|
||||
// const blob = await urlToBlob(form.value.image);
|
||||
// formData.append('file', blob, 'image.jpg'); // 添加文件名
|
||||
// }
|
||||
// 添加其他必要字段
|
||||
const fields = ['id', 'deviceName', 'deviceType', 'remark'];
|
||||
fields.forEach((key) => {
|
||||
|
||||
Reference in New Issue
Block a user