Home > Web Front-end > JS Tutorial > vue.js implements printer connection

vue.js implements printer connection

零到壹度
Release: 2018-03-26 10:16:07
Original
5396 people have browsed it

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(&#39;dialogCare&#39;)[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;
    },
Copy after login

Related recommendations:

jquery connects to the printer

API 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!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template