一、调出打印页面直接打印
//toolbar=no,location=no,directories=no,status=no 这些特征将分别隐藏工具栏、地址栏、目录按钮和状态栏。 window.open(routeData.href, 'newWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no'); mounted() { this.print(); }, methods: { print() { setTimeout(function(){ // // 指定元素打印。 let oldStr = window.document.body.innerHTML; let newStr = document.getElementById('divPrint').innerHTML; window.document.body.innerHTML = newStr; window.print(); window.document.body.innerHTML = oldStr; }, 1000); } } <style scoped> /* 去除页眉页脚及网址 */ @page { margin-top: 0; margin-bottom: 0 } </style>html js style
打印二维码问题见:https://www.cnblogs.com/xbding/p/16106168.html
标签:no,打印,innerHTML,window,print,document,页面 From: https://www.cnblogs.com/xbding/p/18157813