VUE学习记录(打印组件的使用)

使用VUE组件进行打印操作

1、安装组件

npm install vue-print-nb --save

2、main.js引入代码

import Print from 'vue-print-nb'
Vue.use(Print);

3、调用

<template>
    <div class="page-container" style="width:740px;margin:0 auto">
        <div id="printMe">
                <printPdf
                        v-loading="loading"
                        :templateId="templateId"
                        :tesrBrach="materialBatch" >
                </printPdf>//引入需要打印的页面
        </div>
        <el-row :gutter="20">
            <el-col :span="24" class="confirm-btn-cnt" >
                <el-button type="primary" size="mini" v-print="'#printMe'">打印</el-button>
            </el-col>
        </el-row>
    </div>
...........................

猜你喜欢

转载自blog.csdn.net/qq_40844662/article/details/103561026