# vue-electronicsignature

> 基于 Vue 的电子签名组件

Latest version **1.9.1** (published 2022-05-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-electronicsignature
pnpm add vue-electronicsignature
yarn add vue-electronicsignature
bun add vue-electronicsignature
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.1 |
| Published | 2022-05-26 |
| First published | 2020-10-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | alvinliao |
| Maintainers | alvinliao |
| Keywords | 电子签名, 签名组件 |

## Links

- npm: https://www.npmjs.com/package/vue-electronicsignature
- Repository: https://github.com/Alvinyw/vue-electronicSignature
- Issues: https://github.com/Alvinyw/vue-electronicSignature/issues
- npm.io page: https://npm.io/package/vue-electronicsignature

## Recent versions

- 1.9.1 (latest) — 2022-05-26
- 1.9.0 — 2020-10-28
- 1.8.0 — 2020-10-26
- 1.7.0 — 2020-10-26
- 1.6.0 — 2020-10-26
- 1.5.0 — 2020-10-26
- 1.4.0 — 2020-10-25
- 1.3.0 — 2020-10-25
- 1.2.0 — 2020-10-25
- 1.1.0 — 2020-10-25
- 1.0.0 — 2020-10-25

## README

# ElectronicSignature
基于 Vue 的电子签名组件

## 一、通过 Node 引用

```javascript
npm i vue-electronicsignature
```

在 VUE 的 SPA 中的使用示例：

```html
<template>
  <div id="main">
    <div id="navBar">电子签名</div>
    <div class="signature-box" :style="signatureStyle">
      <ElectronicSignature @onSuccessBack="handleSuccess" />
    </div>
  </div>
</template>
<script>
import ElectronicSignature from "vue-electronicsignature";
export default {
  name: "Signature",
  components: { ElectronicSignature },
  data() {
    return {
      signatureStyle: ""
    };
  },
  mounted() {
    this.$nextTick(() => {
      // 固定 topBar 的位置
      const topBarEle = document.querySelectorAll("div[id='navBar']")[0];
      const _topBarH = topBarEle.clientHeight;

      // 初始化签名组件的样式
      const _windowH = window.innerHeight;
      const _windowW = window.innerWidth;
      const _containerH = _windowH - _topBarH;
      this.signatureStyle = "height:" + _containerH + "px;" + "width:" + _windowW + "px;" + "top:" + _topBarH + "px";
    });
  },
  methods: {
    handleSuccess(img) {
      alert(img);
    }
  }
};
</script>
<style lang="scss" scoped>
#main {
  min-height: 100vh;
  width: 100%;
  background: #f5f5f5;
  overflow: hidden;
  #navBar {
    width: 100%;
    height: 50px;
    background-color: #fff;
    text-align: center;
    font-size: 18px;
    line-height: 48px;
    color: #444;
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
  }
  .signature-box {
    position: fixed;
    top: 100px;
    left: 0;
    width: 100%;
    padding: 15px;
    background-color: #f5f5f5;
  }
}
</style>
```

## 二、示例

[Demo](https://alvinyw.github.io/Blog/mobile-demo/#/electronicSignature)

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