添加图片大小
This commit is contained in:
parent
6e19aa583d
commit
9dad777061
@ -1,3 +1,4 @@
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
/**
|
||||
* 图片转Base64
|
||||
@ -65,6 +66,11 @@ export function provenimg(file: any): boolean | void{
|
||||
const ntypearr = file.name.split('.');
|
||||
const ntype = ntypearr[ntypearr.length - 1];
|
||||
console.log(ntype)
|
||||
const size = 2 * 1024 * 1024;
|
||||
if(file.size > size){
|
||||
message.error("最大2MB")
|
||||
return false;
|
||||
}
|
||||
let istype = false
|
||||
for(const i in type){
|
||||
if(type[i] == ntype){
|
||||
@ -87,11 +93,13 @@ export function provenvideo(file: any, isvideo?: boolean): boolean{
|
||||
if(isvideo){
|
||||
const size = 500 * 1024 * 1024;
|
||||
if(file.size > size){
|
||||
message.error("最大500MB")
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
const size = 100 * 1024 * 1024;
|
||||
if(file.size > size){
|
||||
message.error("最大100MB")
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user