<div class="dialogCare">
<span>hello word!</span> //要打印的内容
</div>
<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;
},
vue.js如何连接打印机
猜你喜欢
转载自blog.csdn.net/call_me_small_pure/article/details/79693449
今日推荐
周排行