1.0.2 • Published 6 years ago

html-element-print v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

HTML Element Print

demo

安装

npm install html-element-print

引入方式

CommonJS 或者 es6引入方式

  import htmlElementPrint from 'html-element-print';

原始引入方式

    <script type="text/javascript" src="print-html-element.js"></script>

element 支持 text html或者 dom对象.

examples

  const element = document.querySelector('#printElement');
  htmlElementPrint(element, {sourceType: 'dom'});

使用

    htmlElementPrint(element, options);

api

参数说明

    1. element: 原生dom对象或html字符串
    1. options: 配置说明, 类似为object
成员说明类型默认值
htmlType设置element类型(domObjtext)stringdomObj
printMode打印的方式string(popup)stringdefault
pageTitle打印标题string-
templateString打印的模板见:example
popupProperties设置新开窗口window.open参数string''
stylesheets设置打印的外部样式表''
styles设置打印的内部样式表''