# ha-print

> #### 演示案例：

Latest version **1.1.0** (published 2020-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install ha-print
pnpm add ha-print
yarn add ha-print
bun add ha-print
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-07-09 |
| First published | 2020-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zhaohaha |

## Links

- npm: https://www.npmjs.com/package/ha-print
- Repository: http://10.131.12.9:8181/repository/public-npm/
- Issues: http://10.131.12.9:8181/repository/public-npm/
- npm.io page: https://npm.io/package/ha-print

## Dependencies (3)

- [element-ui](https://npm.io/package/element-ui.md) ^2.12.0
- [font-awesome](https://npm.io/package/font-awesome.md) ^4.7.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.7.2

## Recent versions

- 1.1.0 (latest) — 2020-07-09
- 0.0.1 — 2020-07-09
- 1.0.0 — 2020-07-02

## README

## 打印

#### 演示案例：

1.创建一个vue.js项目并启动。

```
npm install -g @vue/cli @vue/cli-service-global' 
npm run dev
```
2.在入口文件 main.js中引入。

```
import { Print } from 'csdc-print/lib/print/index'
```
3.在template中添加DOM结构。
```
  <!-- 绑定事件 -->
  <button @click="dy">打印</button>
   <!-- 要打印的范围 -->
  <div id="content" ref="content" v-html="content" />

```

4.在script中定义数据与编写逻辑。
```
export default {
  name: 'print-demo',
  data () {
    return {
      content: `<div>测试内容</div>`
    }
  },
  methods: {

    /**
     * id:dom元素id
     * 打印指定id范围内的内容
     */

    dy () {
      this.$print({
        id: 'content'
      })
    }

    /**
     * html:html片段
     * 打印指定html范围内的内容
     */
    // dy () {
    //   this.$print({
    //     html: this.$refs.content.innerHTML
    //   })
    // }
  }
}
```

---
_Source: https://npm.io/package/ha-print · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
