每次开始截图前是浏览器置顶
window.scrollTo(0,0);
白屏和微信无法截图是可以尝试降低版本,如果还无法解决可以使用大神的方案 https://github.com/FEA-Dven/html2Canvas
// 引入
import html2canvas from "../../lib/html2canvas";
// 使用, 全局window对象加入html2canvas,如果没有window就调用原来的,所以需要做判断
(window.html2canvas || html2canvas)(shareContent, opts)
.then(canvas => {
let url = canvas.toDataURL("image/png");
console.log(url)
})
.catch(err => {
// do sth
});