Vue js + Element UI [如何打印表格?]

时间:2018-10-15 02:55:51

标签: javascript vue.js

我将io元素用作组件。现在,我的问题是我使用此window.print()进行打印,但可以打印整个页面。但是我只想打印表格。

2 个答案:

答案 0 :(得分:2)

由于您正在使用Vuejs,

您可以在vuejs中使用“ vue-print-nb”插件在网页上打印特定元素。

使用v-pript属性打印选定的元素

示例

//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>

注意

您可以在不提供v-print属性ID的情况下打印整个页面

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

答案 1 :(得分:0)

好吧,您只需要隐藏所有内容

<?php
$target_path = "./uploads/";  
$target_path = $target_path . basename( $_FILES['file']['name']);  
   if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {  
  echo "The file ".  basename( $_FILES['file']['name'])." has been    uploaded";  
} else {  
    echo "There was an error uploading the file, please try again!";  
} ?>