需要压缩图片功能,目前已经在纯 html 和 js 环境测试 OK 了,移植到 vue-cli 的环境有一段提示报错,let img = new Image()
vue-cli 的环境不支持 Image() 应该怎么做呢
export default function compress (base64) {
let img = new Image()
img.src = base64
}
报错
error no-undef 'Image' is not defined
let img = new window.Image()
let win = window
let img = new win.Image()
已解决, eslint 的 bug