vue dowanload file
download base64 file
template
<a ref="download" v-show="false" :href="downloadUrl" :download="downloadfilename"></a>
script
export default { data () { return { downloadUrl: null, downloadfilename: null } }, mounted () { let base64Data = 'data:image/png;base64,iVBORw0KGgoAAAAN...' console.log(base64Data) this.downLoadImage(base64Data) }, methods: { downLoadImage (imgUrl) { let timestamp = new Date().getTime() let name = imgUrl.substring(22, 30) + timestamp + '.png' this.downloadUrl = imgUrl this.downloadfilename = name setTimeout(() => { this.$refs.download.click() }, 200) } } }