vue 打印插件 使用方法

import Print from '@/plugs/print'
Vue.use(Print) // 注册
<template>
<section ref="print">
	打印内容
	<div class="no-print">不要打印我</div>
</section>
</template>
this.$print(this.$refs.print) // 使用
注意需要使用ref获取dom节点事项,若打印通过id或class获取则webpack直接打包部署后打印内容为空 指定不区域 方法一。添加no-print样式类

<div class="no-print">不要打印我</div>
方法二。自定义类名

<div class="do-not-print-me-xxx">不要打印我</div>
this.$print(this.$refs.print,{'no-print':'.do-not-print-me-xxx'}) // 使用

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注