feat:文件组件上传调整
This commit is contained in:
parent
a709cc5094
commit
d07542d480
|
|
@ -204,7 +204,7 @@ const handleUpload = (res) => {
|
||||||
clearInterval(timmer.value);
|
clearInterval(timmer.value);
|
||||||
timmer.value = null;
|
timmer.value = null;
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
res.data.url = import.meta.env.VITE_UPLOAD_IMG_URL + res.data.filepath;
|
res.data.url = res.data.filepath;
|
||||||
res.data.fileType = getFileType(res.data.url);
|
res.data.fileType = getFileType(res.data.url);
|
||||||
fileList.value.push(res.data);
|
fileList.value.push(res.data);
|
||||||
emits("onUpdate", fileList.value);
|
emits("onUpdate", fileList.value);
|
||||||
|
|
@ -222,9 +222,9 @@ const handleRemove = (val: any) => {
|
||||||
arr.forEach((item: any, index: any) => {
|
arr.forEach((item: any, index: any) => {
|
||||||
if (item == val) {
|
if (item == val) {
|
||||||
arr.splice(index, 1);
|
arr.splice(index, 1);
|
||||||
emits("onUpdate", arr);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
emits("onUpdate", arr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -290,10 +290,9 @@ const getFileType = (fileName) => {
|
||||||
const setFiles = () => {
|
const setFiles = () => {
|
||||||
fileList.value = [];
|
fileList.value = [];
|
||||||
props.listPic.forEach((item: any) => {
|
props.listPic.forEach((item: any) => {
|
||||||
item.url = import.meta.env.VITE_UPLOAD_IMG_URL + item.filepath;
|
item.url = item.filepath;
|
||||||
item.fileType = getFileType(item.url);
|
item.fileType = getFileType(item.url);
|
||||||
fileList.value.push(item);
|
fileList.value.push(item);
|
||||||
emits("onUpdate", fileList.value);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user