1.0.2 • Published 2 years ago
shprint v1.0.2
安装包
npm i shprint -S
页面引入 页面中直接调
import {print} from 'shprint'
.
.
.
print(dom,options)
也可main.js
引入 全局定义
import Print from 'shprint'
Vue.use(Print)
页面使用
this.$print(dom,options)
参数
dom
HTMLElement
需要打印的HTML
元素
options
配置
options:{
width: 1920, // 页面宽 默认1920
//页眉配置
header: {
left: 50, //左偏移量
content: "这是页眉", //内容
color: "red", //字体颜色
url: require('./...'), // 插入图片需引用base64 插入图片content 无效
fontSize: 60, // 字体大小
},
//页脚配置
fooder: {
left: 100, //左偏移量
content: "这是页脚", //内容
color: "", //字体颜色
url: require('./...'), // 插入图片需引用base64 插入图片content 无效
fontSize: "60", // 字体大小
},
//打印内容配置
container: {
top: 100, //打印内容上边
left: 100 //打印内容左边
}
}