npm install html2canvas jspdf --save
<div id="printBox" ref="printBox"> </div>
import html2pdf from "html2pdf.js";
const printBox = ref(null)
async function printOrderCard(){
let opt = {
margin: 0,
filename: "22",
image: { type: "jpeg", quality: 1 },
html2canvas: { scale: 3, },
jsPDF: { unit: "in", format: 'a4',orientation: style },
};
const node = printBox.value;
html2pdf().set(opt).from(node).outputPdf().then(function(pdf) {
}).catch((res)=>{
message.error("页面计算失败")
});
}