当我尝试用
保存图像时,图像会被保存transferFiles(){
this.checkMark = true
let i = 0
this.finalImages.forEach((image) =>{
i++
saveAs(image, "imagem.jpg"+i);
})
}
这是错误:
vue.runtime.esm.js?2b0e:1888 ReferenceError: saveAs is not defined
at eval (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/SelectImagesSection.vue?vue&type=script&lang=js&:424)
at Array.forEach (<anonymous>)
at VueComponent.transferFiles (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/SelectImagesSection.vue?vue&type=script&lang=js&:422)
at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1853)
at HTMLInputElement.invoker (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:2178)
at HTMLInputElement.original._wrapper (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6907)
logError @ vue.runtime.esm.js?2b0e:1888
基本上,所有图像都被保存,但不能保存它说savea没有定义
只需导入并安装文件保存功能即可从'file-saver'中导入文件