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

canvas-sign

v1.1.3

Published

基于 Taro 小程序的一款 Canvas 签名插件

Downloads

1

Readme

基于 Taro 小程序的一款 Canvas 签名插件

应用场景

关于合同/协议 需要手写签字的业务场景 注: 该插件仅适用于Taro小程序

使用方法

1. /*安装*/ npm i canvas-sign -S

2. /*引入*/ import { CanvasSign } from "canvas-sign";

3. /*使用*/ <CanvasSign
              canvasWidth={String}
              canvasHeight={String}
              textOptions={Array}
              lineOption={Array}
              clearAction={Boolean}
              exportAction={Boolean}
              onCanvasExport={Function}
            />

相关 API

canvasWidth / canvasHeight 画布尺寸

type: String

  • example:
const canvasWidth = "100vw";
const canvasHeight = "100vh";

textOptions 文本

type: Array

  • example:
const textOptions = [
      {
        text: "基于 Taro 小程序的一款 Canvas 签名插件",
        x: 50,
        y: 30,
        fontColor: "#000000",
        fontSize: 16,
        lineHeight: 15,
        padding: 20,
        maxLines: 1
      },
      /*参数详解*/
      {
        text: 文本内容,
        x: 位置x,
        y: 位置y,
        fontColor: 字体颜色,
        fontSize: 字体大小,
        lineHeight: 字体行高,
        padding: 字体水平边距,
        maxLines: 最大行数 超出显示省略号
      }
    ];

lineOption 线段

type: Array

  • example:
const lineOption = [
  {
    x: 20,
    y: 215,
    _x: 300,
    _y: 215,
    w: 0.5
  },
  /*参数详解*/
  {
    x: 线段起始点x,
    y: 线段起始点y,
    _x: 线段结束点x,
    _y: 线段结束点y,
    w: 线段宽度
  }
];

清除画布行为 clearAction

type: Boolean

  • example:
const clearAction = false;

/*注: 开发者只需改变该布尔值即可清除画布*/

将画布导出为图片行为 exportAction

type: Boolean

  • example:
const exportAction = false;

/*注:获取画布图片需两个参数: 1.exportAction  2.onCanvasExport
  开发者只需改变该布尔值即可导出画布,导出后的画布通过回调函数onCanvasExport的参数拿到
  需开发者手动提供该回调函数 onCanvasExport*/

/*注: 目前只支持.jpg格式*/

获取画布导出后的图片的回掉 onCanvasExport

type: Function

  • example:
const onCanvasExport = data => {
  console.log("监听到exportAction的值发生变化后获取到的画布图片:", data);
  /*注: 开发者只需改变该布尔值即可清除画布*/
};