要引入插件
具体怎么引入依赖参考官网
import Print from 'vue-print-nb'
Vue.use(Print)
html部分,template部分
<el-date-picker
:clearable="false"
v-model="sYearMon"
type="month"
placeholder="年月"
size="mini"
value-format="yyyy-MM"
value="yyyy-MM"
@change="getData(sYearMon);sYearMonChange(sYearMon)"
></el-date-picker>
<div>
<div id="box" style="width: 100%; height: 100%">
<h5 style="font-size: 16px; height: 25px;line-height: 25px;">{
{ sYearMon }}</h5>
<table border="1" style="height: 100%; width: 100%;table-layout:fixed;">
<tr style="height: 45px">
<th>一</th>
<th>二</th>
<th>三</th>