Home >Web Front-end >JS Tutorial >vue.js implements printer connection
This article mainly introduces how to connect the printer with vue.js. The article introduces it in detail through the sample code, which has certain reference and learning value. I hope it can help everyone.
<p class="dialogCare"> <span>hello word!</span> //要打印的内容</p> <button @click="printBtn()">打 印</button> printBtn(){ let newstr = document.getElementsByClassName('dialogCare')[0].innerHTML; console.log(newstr) window.document.body.innerHTML = newstr; let oldstr = window.document.body.innerHTML; window.print(); window.location.reload(); //解决打印之后按钮失效的问题 window.document.body.innerHTML = oldstr; return false; },
Related recommendations:
jquery connects to the printer
JAVA connects to printer to print receipt
The above is the detailed content of vue.js implements printer connection. For more information, please follow other related articles on the PHP Chinese website!