更新数据
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
|
||||
import ImageCompressor from "image-compressor.js";
|
||||
// 随机颜色 - 把16进制的颜色换成rgba格式
|
||||
export function choseRbgb(color,opcity) {
|
||||
if(color){
|
||||
@ -23,6 +23,26 @@ export function randomHexColor() { // 随机生成十六进制颜色
|
||||
return '#' + hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩图片
|
||||
* @param {*} file
|
||||
* @param {*} quality 压缩比
|
||||
*/
|
||||
export function compressImage(file, quality = 0.6) {
|
||||
return new Promise((resolve, reject) => {
|
||||
new ImageCompressor(file, {
|
||||
quality, //压缩质量
|
||||
success(res) {
|
||||
let fileData = new File([res], res.name, { type: res.type });
|
||||
resolve(fileData);
|
||||
},
|
||||
error(e) {
|
||||
reject("图片压缩失败,请稍后再试");
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 今天周几
|
||||
export function weekValidate() {
|
||||
let week = new Date().getDay()
|
||||
|
Reference in New Issue
Block a user