# BatchCode
**Repository Path**: guobaocui/batch-code
## Basic Information
- **Project Name**: BatchCode
- **Description**: 批量生成二维码支持打印
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2023-04-10
- **Last Updated**: 2023-04-12
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# vue-qrcodejs2 批量打印(PC 端)
---


#### 技术栈
vue2 + webpack + ES6/7 +qrcodejs2+print.js
#### 使用插件
下载
npm install print-js --save
yarn add print-js
导入
import print from 'print-js'
import 'print-js/dist/print.css';
Vue.prototype.$print = printjs;
import Print from 'vue-print-nb';
Vue.use(Print);
import pluginsPrint from './plugins/print';
Vue.use(pluginsPrint); // 注册
#### 参考链接
https://github.com/xyl66/vuePlugs_printjs
https://juejin.cn/post/6888519415717953549
####
```bash
// 设置打印内容不可见 将打印的内容转化成图片形式 printStyle 推荐使用这个 只需要设置display:none 就可以看不到二维码
printJS({
printable: 'printStyle',
type: 'html',
targetStyles: ['*'],
style: '@page {margin:0 10mm};',
});
打印内容可见
setTimeout(() => {
this.$print(this.$refs.print);
}, 200);
```
```bash
vue 打印插件 使用方法
import Print from '@/plugs/print'
Vue.use(Print) // 注册