vue 打印html
1、https://github.com/xyl66/vuePlugs_printjs从这个路径下载print.js。放到你的代码中
2、我是放到我本地一个js文件中。

3、引入当前文件
//打印插件 import Print from './utils/print' Vue.use(Print) // 注册
4、页面应用
<template>
<section ref="print" style="max-height: 1000px;width: 800px;margin: 0 auto;">
<p>我的打印的内容</p>
</section>
</template>
<script>
this.$print(this.$refs.print)
</script>
把需要打印的东西放入这个标签中就可以了。
当内容中有不需要打印的东西时可以这样
<p class="no-print">不要打印</p>
浙公网安备 33010602011771号