0.1.0 • Published 1 year ago

gao-canvas-sign v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vue3签名组件

安装

pnpm install gao-canvas-sign

使用

<template>
   <Sign ref="signRef" color="#000" :lineWidth="2" background-color="#ccc" :width="100" :height="300"></Sign>
</template>

<script>
import { ref } from 'vue';
import Sign from './Sign/index.vue'
let signRef = ref<InstanceType<typeof Sign>>()


function getUrl() {
  // 获取临时url地址
  let url = signRef.value!.getUrl()
  console.log('url::::::::::::::::', url)
}

function getBlob() {
  signRef.value?.getBlob().then(blob => {
    console.log('blob::::::::::::::::', blob)
    // 转成file对象  用于文件上传
    let file = new File([blob!], 'sign.png', { type: 'image/png' })
    console.log('file::::::::::::::::', file)
  })
}
</script>

参数

参数名说明类型默认值
color签名文字颜色string#000
lineWidth签名线条宽度number2
background-color签名区域背景颜色string#ccc
width签名区域宽度number300
height签名区域高度number300

事件

事件名描述参数返回值
getUrl获取签名图片的临时url地址--
getBlob获取签名图片的blob对象-Primise
reset清空签名--
0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.0

1 year ago