npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-signature-pad

v3.0.2

Published

SignaturePad component for Vue.js

Downloads

128,353

Readme

Vue Signature Pad

Build Status npm styled with prettier

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

| Name | Type | Default | Description | Example | |:------------------------|:--------|:--------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------| | width | String | 100% | Set the div width. | - | | height | String | 100% | Set the div height. | - | | options | Object | Reference | Set the signature pad options. | Reference | | images | Array | [] | 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 }] | | customStyle | Object | {} | Custom div style. | { border: black 3px solid } | | scaleToDevicePixelRatio | Boolean | true | Scale the canvas up to match the device pixel ratio. | - |

Methods

| Name | Argument Type | Description | | :------------------------------------- | :--------------------------- | --------------------------------------------------------------------------- | | saveSignature(type, encoderOptions) | (String, Number) | Will return target canvas status and data. | | undoSignature() | - | Undo | | clearSignature() | - | Clear | | mergeImageAndSignature(signature) | Object or String | Provide images as props and will merge with signature. | | addImages(images) | Array | Provide 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) | String | Returns 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