vue实现下载图片文件,将图片类型的文件下载到本地 //下载文件,文件 export function download(data,name) { if (!data) { return; } getUrlBase64(data).then((base64) => { let a = document.createElement("a"); a.style.display = "none"; a.download = name; a.href = base64; document.body...
vue实现下载图片文件,将图片类型的文件下载到本地 //下载文件,文件 export function download(data,name) { if (!data) { return; } getUrlBase64(data).then((base64) => { let a = document.createElement("a"); a.style.display = "none"; a.download = name; a.href = base64; document.body...
vue中用ref来指定你需要转成图片下载的dom const downloadCode = () => { html2canvas(this.$refs.codeRef).then(canvas => { const base64 = canvas.toDataURL('image/png') const myBlob = dataURLtoBlob(base64) const myUrl = URL.createObjectURL(myBlob) downloadFile(myUrl, '报名二维码') }) ...