Vue+Print.js配置与onPrintDialogClose无效问题处理
作者:互联网
日常配置:
npm install print-js --save
在需要打印的页面引入
import printJS from "print-js"
示例与onPrintDialogClose无效问题解决
<el-button type="primary" icon="el-icon-printer" @click="doPrint" >打印</el-button><script> export default{ methods: { doPrint() { let focuser = setInterval(() => window.dispatchEvent(new Event('focus')), 500); printJS({ printable: 'mzTable-' + this.tid, type: 'html', scanStyles: false, css:'/static/css/print.css',//css路径:public/static/css/ onPrintDialogClose: () => {//取消打印回调 clearInterval(focuser); console.log("瞅你咋地"); } }) } } } </script>
标签:Vue,打印,js,print,printJS,Print,onPrintDialogClose,css 来源: https://www.cnblogs.com/sonicyard/p/14333535.html