导出部分js代码
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
export default {
install (Vue, options) {
Vue.prototype.$getPdf = function (id, title) {
// 获取当前浏览器滚动条的宽度,原理是设置一个不可见的div,查看设置scorll前后的宽度差
function getScrollWidth () {
var noScroll, scroll
var oDiv = document.createElement('DIV')
oDiv.style.cssText = 'position:absolute; top:-1000px; width:100px; height:100px; overflow:hidden;'
noScroll = document.body.appendChild(oDiv).clientWidth
oDiv.style.overflowY = 'scroll'
scroll = oDiv.clientWidth
document.body.removeChild(oDiv)
return noScroll - scroll
}
const SIZE = [595.28, 841.89] // a4宽高
let node = docu