This commit is contained in:
2024-10-16 15:31:00 +08:00
parent 6a15bbb2e0
commit c0e40bee86
4 changed files with 27 additions and 12 deletions

View File

@@ -74,7 +74,7 @@ const _sfc_main = defineComponent({
return new Promise((resolve, reject) => {
var options = {
file,
quality: 0.6,
quality: props.quality,
mimeType: "image/jpeg",
maxWidth: 2e3,
maxHeight: 2e3,
@@ -194,7 +194,12 @@ const _sfc_main = defineComponent({
if (Array.isArray(files) && files.length > 0) {
for (let i = 0; i < files.length; i++) {
let _file = files[i];
let f = await imgcomp(_file);
let f;
if (props.quality) {
f = await imgcomp(_file);
} else {
f = _file;
}
formData.append(props.field + "[" + i + "]", f);
}
}