Files
knowledge-kit/Chapter2 - Web FrontEnd/2.11.md
2020-02-25 17:46:51 +08:00

11 lines
467 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# H5页面保存页面为图片
方案有个github的js库可以将html转换为canvas然后canvas可以转换为图片然后图片可以下载所以基本路线就是
* html2canvas.js 将htmldom转为canvas [https://github.com/niklasvh/html2canvas](https://github.com/niklasvh/html2canvas "html2canvas")
* canvasAPI toDataUrl\(\)将canvas转为base64格式
* 图片下载
具体描述https://juejin.im/post/5a17c5e26fb9a04527254689