// setTimeout(() => { // // 获取要导出的DOM // const rect = document.getElementById('iklDetailAll').getBoundingClientRect() // html2canvas(document.getElementById('iklDetailAll'), { // width: rect.width, // height: rect.height // }).then(function (canvas) { // const pageData = canvas.toDataURL('image/jpeg', 1.0) // const imgData = pageData.replace('image/jpeg', 'image/octet-stream') // const imgName = '生成图片.jpg' // const save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a') // save_link.href = imgData // save_link.download = imgName // const event = document.createEvent('MouseEvents') // event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) // save_link.dispatchEvent(event) // }) // // },3000)
标签:截图,document,false,image,功能,js,link,const,save From: https://www.cnblogs.com/myqinyh/p/16834723.html