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