The webpage written by vue needs to print the content of the specified area, retain the original webpage style, and the original webpage content cannot be changed after printing, and jqprint cannot be used. How can this be achieved?
習慣沉默2017-05-19 10:45:23
@media print {
.not-print {
opacity: 0
}
}
In the area you don’t want to print, add the .not-print class~
A rough way. . .
怪我咯2017-05-19 10:45:23
Basically the idea on the first floor, media queries are hidden in blocks that do not need to be printed when printing.
You can use opacity or visibility to hide.
天蓬老师2017-05-19 10:45:23
http://stackoverflow.com/ques...
mywindow.document.write(this.$el.innerHTML);
PHP中文网2017-05-19 10:45:23
Print part of the web page
var createPdf = () => {
let newWindow = window.open("_blank"); //打开新窗口
let codestr = document.getElementById("pdf-wrap").innerHTML; //获取需要生成pdf页面的p代码
newWindow.document.write(codestr); //向文档写入HTML表达式或者JavaScript代码
newWindow.document.close(); //关闭document的输出流, 显示选定的数据
newWindow.print(); //打印当前窗口
return true;
}