项目
在 GitHub 查看
wobsoriano/v-perfect-signature
关于
Pressure-sensitive signature drawing for Vue 2 and 3
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文v-perfect-signature
Pressure-sensitive signature drawing for Vue 2 and 3 built on top of perfect-freehand.
Demo: https://wobsoriano.github.io/v-perfect-signature
Install
pnpm add v-perfect-signature
Usage
<script setup>
import { ref } from 'vue'
import { VPerfectSignature } from 'v-perfect-signature'
const signaturePad = ref()
const strokeOptions = {
size: 16,
thinning: 0.75,
smoothing: 0.5,
streamline: 0.5,
}
function toDataURL() {
const dataURL = signaturePad.value.toDataURL()
console.log(dataURL)
}
</script>
<template>
<VPerfectSignature ref="signaturePad" :stroke-options="strokeOptions" />
</template>
Props
| Name | Type | Default | Description |
|---|---|---|---|
width |
String | 100% |
Set canvas width |
height |
String | 100% |
Set canvas height |
backgroundColor |
String | rgba(0,0,0,0) |
Canvas background color |
penColor |
String | #000 |
Canvas pen color |
strokeOptions |
Object | Reference | Perfect freehand options |
Methods
| Name | Argument Type | Description |
|---|---|---|
toDataURL(type) |
String | Returns signature image as data URL |
fromDataURL(dataUri) |
String | Draws signature image from data URL |
toData |
- | Returns signature image as an array of array of input points |
fromData(data) |
Array | Draws signature image from array of array of input points |
clear() |
- | Clears the canvas |
isEmpty() |
- | Returns true if canvas is empty |
resizeCanvas(shouldClear) |
Boolean |
Resizes and recalculate dimensions |
Note: Like signature_pad, fromDataURL does not populate internal data structure. Thus, after using fromDataURL, toData won't work properly.
Events
| Name | Type | Default | Description |
|---|---|---|---|
onBegin |
Function | - | Fired when stroke begin |
onEnd |
Function | - | Fired when stroke end |
Nuxt
export default defineNuxtConfig({
build: {
transpile: ['v-perfect-signature']
}
})
License
MIT
探索相关项目
加载中…