mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
improve: 图片上传大小判断
This commit is contained in:
parent
cf9f212b6f
commit
b1e7bdcd90
@ -77,9 +77,13 @@ export default {
|
||||
});
|
||||
this.imgList.splice(index, 1);
|
||||
this.$nextTick((e) => {
|
||||
this.imgList.map((e) => {
|
||||
this.allSize += e.raw.size;
|
||||
});
|
||||
if (this.imgList.length) {
|
||||
this.imgList.map((e) => {
|
||||
this.allSize += e.raw.size;
|
||||
});
|
||||
} else {
|
||||
this.allSize = 0;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -118,14 +122,20 @@ export default {
|
||||
return new Blob([u8arr], { type: mime });
|
||||
},
|
||||
fileChange(file, fileList) {
|
||||
compressImg(file.raw).then((res) => {
|
||||
if (fileList.length) fileList[fileList.length - 1].raw = res;
|
||||
if (file.size >= 2097152) {
|
||||
compressImg(file.raw).then((res) => {
|
||||
if (fileList.length) fileList[fileList.length - 1].raw = res;
|
||||
this.imgList = fileList;
|
||||
this.imgList.map((e) => {
|
||||
this.allSize += e.raw.size;
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.imgList = fileList;
|
||||
this.imgList.map((e) => {
|
||||
console.log(e);
|
||||
this.allSize += e.raw.size;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
loadData(item, callback) {
|
||||
getCategoryListApi({
|
||||
@ -167,7 +177,7 @@ export default {
|
||||
font-size: 18px;
|
||||
right: 1px;
|
||||
top: 1px;
|
||||
color: red;
|
||||
color: #999;
|
||||
}
|
||||
.img-box {
|
||||
display: flex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user