files.map ((item, index) => { return lrz (item.url, { quality: 0.7, }).then (rst => { // 处理成功会执行 imageList.push (rst.base64); this.setState ({imagesrc: imageList}); }); });
export function resizeImage(file, opts) { const config = { width: null, height: null, quality: 0.7, filename: 'file' }; opts = opts || {}; for (let p in opts) { if (!opts.hasOwnProperty(p)) continue; config[p] = opts[p] } return lrz(file, {width: config.width, height: config.height, quality: config.quality, filename: config.filename}) }