[Vuejs]-Vue js + Element UI [How to print table?]

1👍

Well you just need to hide everything

@media print{
  *{ display: none; }
  table { display: block; }
}

6👍

Since You are using Vuejs,

You can use “vue-print-nb” plugin in vuejs to print specific element on a web page.

Use v-pript attribute to print a selected element

Example

//this is the table you want to print
<table id="myTable">
    ...
    ... //Your table code goes here
</table>

// Set table id to "v-print" attribute.
// This will do the trick.
<button v-print="'#myTable'">Print Table</button>

Note

You can print the entire page without providing an id to the v-print attribute

<button v-print>Print the entire page</button>

Leave a comment