关于Vue使用print插件,打印时会有多出来的空白页问题解决

3,571 阅读1分钟

vue使用print打印时,会多出空白页,这多半是外边距导致的,将打印的dom对象的margin 设置为0,即可解决

<style media="printContent">
@page {
size: auto; /* auto is the initial value /
margin: 3mm; / this affects the margin in the printer settings */
}

html {
background-color: #ffffff;
margin: 0px; /* this affects the margin on the html before sending to printer */
}

body {
border: solid 1px rgba(255,255,255,0);
/* margin: 10mm 15mm 10mm 15mm; margin you want for the content */
}
</style>