3.0.2 • Published 2 years ago

vue-signature-pad v3.0.2

Weekly downloads
9,812
License
MIT
Repository
github
Last release
2 years ago

Vue Signature Pad

Build Status npm styled with prettier npm.io

Vue component wrap for signature pad

Note: If you are still using Vue 2, please install 2.0.5 version, for Vue 3 you can install the latest publish version.

Demo

Edit Vue Signature Pad Demo

Installation

$ yarn add vue-signature-pad

Usage

import Vue from 'vue';
import VueSignaturePad from 'vue-signature-pad';

Vue.use(VueSignaturePad);
<template>
  <div id="app">
    <VueSignaturePad width="500px" height="500px" ref="signaturePad" />
    <div>
      <button @click="save">Save</button>
      <button @click="undo">Undo</button>
    </div>
  </div>
</template>
<script>
export default {
  name: 'MySignaturePad',
  methods: {
    undo() {
      this.$refs.signaturePad.undoSignature();
    },
    save() {
      const { isEmpty, data } = this.$refs.signaturePad.saveSignature();
      console.log(isEmpty);
      console.log(data);
    }
  }
};
</script>

vue-signature-pad use szimek/signature_pad default setting as options, feel free custom you wanted options. In v1.1 add onBegin and onEnd event callback:

<template>
  <div id="app">
    <VueSignaturePad
      width="500px"
      height="500px"
      ref="signaturePad"
      :options="{ onBegin, onEnd }"
    />
  </div>
</template>
<script>
export default {
  methods: {
    onBegin() {
      console.log('=== Begin ===');
    },
    onEnd() {
      console.log('=== End ===');
    }
  }
};
</script>

Props

NameTypeDefaultDescriptionExample
widthString100%Set the div width.-
heightString100%Set the div height.-
optionsObjectReferenceSet the signature pad options.Reference
imagesArray[]Merge signature with the provide images.['A.png', 'B.png', 'C.png'] or [{ src: 'A.png', x: 0, y: 0 }, { src: 'B.png', x: 0, y: 10 }, { src: 'C.png', x: 0, y: 20 }]
customStyleObject{}Custom div style.{ border: black 3px solid }
scaleToDevicePixelRatioBooleantrueScale the canvas up to match the device pixel ratio.-

Methods

NameArgument TypeDescription
saveSignature(type, encoderOptions)(String, Number)Will return target canvas status and data.
undoSignature()-Undo
clearSignature()-Clear
mergeImageAndSignature(signature)Object or StringProvide images as props and will merge with signature.
addImages(images)ArrayProvide the images merge with signature. Reference above images property.
lockSignaturePad()-Lock target signature pad.
openSignaturePad()-Open target signature pad.
getPropImagesAndCacheImages()-Get all the images information.
clearCacheImages()-Clear cache images.
fromDataURL(data, options, callback)(String, Object, Callback)Draw image from data URL.
fromData(data)StringReturns signature image as an array of point groups.
toData()-Draws signature image from an array of point groups.
isEmpty()-Return signature canvas have data.

Credits

szimek/signature_pad - HTML5 canvas based smooth signature drawing

LICENSE

MIT © Peng Jie

3.0.2

2 years ago

3.0.2-beta.3

2 years ago

2.0.5-beta.1

2 years ago

2.0.5

2 years ago

3.0.2-beta.2

2 years ago

3.0.2-beta.1

2 years ago

3.0.1-beta.0

3 years ago

3.0.1

3 years ago

2.0.3

3 years ago

2.0.4

3 years ago

3.0.0

3 years ago

2.0.4-beta.0

3 years ago

2.0.3-beta.3

3 years ago

2.0.3-beta.2

3 years ago

2.0.3-beta.1

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.0-beta.1

4 years ago

1.1.18

4 years ago

1.1.18-beta.1

4 years ago

1.1.17

4 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.14-beta.1

5 years ago

1.1.13

5 years ago

1.1.12-beta.1

5 years ago

1.1.11

5 years ago

1.1.11-beta.1

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.9-beta.2

5 years ago

1.1.9-beta.1

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.7-beta.2

5 years ago

1.1.7-beta.1

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.3-beta

5 years ago

1.1.2-beta.1

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.1.0-beta

6 years ago

1.0.0

6 years ago

0.6.0

6 years ago

0.6.0-beta.2

6 years ago

0.6.0-beta.1

6 years ago

0.5.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.97-beta.1

6 years ago

0.0.96-beta.1

6 years ago

0.0.96

6 years ago

0.0.95-beta.1

6 years ago

0.0.95

6 years ago

0.0.9-beta.4

6 years ago

0.0.9-beta.3

6 years ago

0.0.9-beta.2

6 years ago

0.0.9-beta.1

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago