/*
* @Description:
* @Author: wxj
* @pamars: pamars
*/
/*
* @Description: 文件上传拦截
* @Author: wxj
* @file: 上传文件信息
* @options:上传文件配置项
* @rotate:宽高比;如果配置项中存在该项 就会忽略 width 和 height 等
*/
function asyncUploadImg(file, options) {
if (!file) {
return new Error("file is no null");
}
const {
size = 200,
imgTypes = [".jpg", ".png"],
multipleArr = [1, 2, 3],
rotate,
} = options;
if (size && size > 200) {
return new Error("size so big");
}
if (rotate) {
console.log("宽等于高---hhh");
return;
}
console.log("width, height的设置才会生效", imgTypes, multipleArr);
}
const file = "123";
const options = {
size: 200,
};
asyncUploadImg(file, options);
函数传入对象配置项,如何赋初始值
最新推荐文章于 2023-03-26 11:20:04 发布