1.1.4 • Published 1 year ago

print-my-html-js v1.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

print-my-html-js

打印指定HTML代码块,且支持设置打印文件页面大小。

main.js引入

import printMyHtmlJs from 'print-my-html-js'
Vue.use(printMyHtmlJs)

id="print" 里是需要打印的内容

  • 参数

  • 打印样式:type {String}

    • custom:自定义打印样式
    • default:默认打印样式(默认)
  • 水平排列方式:justifyContent {String}

    • start:左偏移(默认)
    • center:水平居中
    • end:右偏移
  • 纵向排列方式:alignItems {String}

    • start:上偏移(默认)
    • center:纵向居中
    • end:下偏移
  • 打印宽度:printWidth {String} (type="custom"时有效)

    • 210(默认:被打印Dom 宽度;单位:mm)
  • 打印高度:printHeight {String} (type="custom"时有效)

    • 297(默认:被打印Dom 高度;单位:mm)
  • 打印清晰度:printScale {String} (printScale必须大于0)

    • 1(默认)
  • 是否铺满:isPaved {String}

    • default(不铺满)(默认)
    • halfPaved(半页铺满)
    • paved(铺满)
<div id="print" type="custom" printWidth="60" printHeight="40">
  <div class="font-size: 20px;" style="color: red;">
    我是要被打印的内容
  </div>
</div>

v-print-html="'print'" 是触发打印按钮

  • 【'print'】与打印DOM ID对应

<el-button v-print-html="'print'">打印</el-button>
1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago