先将需要打印的内容添加id=print
const el =documnet.getElementById('printRoute').innerHTML;
const iframe =document.createElement('IFRAME');
let doc=null;
document.body.appendChild(iframe);
doc =iframe.contentWindow.document;
doc.write(el);
doc.close();
iframe.contentWindow.focus();
iframe.contentWindow.print();
document.body.removeChild(iframe);