Vue.js Window Print


We can use window print method to print the current window page. Here in this tutorial, we are going to explain how you can use JavaScript Window Print method.


Vue.js Window Print Method Example

We can use window.print() method to print the current window in vue.js-

Example:

<div id="app">
	<button @click="printWindow()">Print</button>
</div>
<script>
 new Vue({
 el: '#app',
  
  data: {
  },  
   methods:{
    printWindow: function () {		
	 window.print();
    }
	}

});
</script>  

Try it »

Output of above example-


Advertisements

User Ans/Comments

<div id="app"> &lt;button @click="printWindow()" v-text="'Print'" /&gt; </div>[removed] new Vue({ el: '#app', methods: { printWindow() { window.print(); }, } }); [removed]
 Jim

Add Comment

📖 Read More