html
//打印按钮
<el-link
type="primary"
icon="el-icon-printer"
@click="handlePrint(scope.row)"
>打印
</el-link>
//打印模态框
<el-dialog :visible="Print" width="100%">
<span slot="footer" class="dialog-footer">
<el-button @click="printCancle">取 消</el-button>
<el-button type="primary" v-print="print">打印</el-button>
</span>
</el-dialog>
data打印配置
// 打印配置
print: {
id: "printArea",
popTitle: "巡检工单打印",
beforeOpenCallback() {}, // 开启打印前的回调事件
openCallback() {
this.printData = [];
this.Print = false;
}, // 调用打印之后的回调事件
closeCallback() {
this.printData = [];
this.Print = false;
}, //关闭打印的回调事件(无法确定点击的是确认还是取消)
},