下载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);
}
上一篇下一篇

猜你喜欢

热点阅读