公司业务的月报页面,要实现pdf下载,查了资料,大概有个方向,就是利用html2canvas把html转为图片,然后再生成pdf格式的文件实现了下载。
核心代码
import html2canvas from 'html2canvas';
import JSPDF from 'jspdf';
export default {
install(Vue, options) {
Vue.prototype.ExportSavePdf = function(htmlTitle, currentTime) {
document.documentElement.scrollTop = 0;
let element = document.getElementById('pdfCentent');
html2canvas(element, {
logging

最低0.47元/天 解锁文章
8644

被折叠的 条评论
为什么被折叠?



