下载canvas图片
2021-02-19 本文已影响0人
antlove
function download(canvas){
var image = canvas.toDataURL("image/png")
var saveLink = document.createElement('a');
saveLink.href = image;
saveLink.download ='download.jpg';
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initEvent('click', true, false);
saveLink.dispatchEvent(clickEvent);
}