Signature 签名

手写签名画板,支持确认、清除和自定义画板尺寸颜色

手写签名画板,支持确认和清除

演示

9:41

代码示例

<!-- 隐藏状态 -->
  <re-button class="demo-signature-trigger-default" theme="primary" @click="showDefault = true">打开签名</re-button>

<!-- 显示状态 -->
  <re-button theme="primary" @click="showVisible = true">显示签名画板</re-button>

<!-- 自定义尺寸 -->
  <re-button theme="primary" @click="showSize = true">自定义尺寸</re-button>

<!-- 自定义线条颜色 -->
  <re-button theme="primary" @click="showLineColor = true">自定义线条颜色</re-button>

<!-- 自定义背景色 -->
  <re-button theme="primary" @click="showBgColor = true">自定义背景色</re-button>

<!-- 自定义线宽 -->
  <re-button theme="primary" @click="showLineWidth = true">自定义线宽</re-button>

<!-- 小画板 -->
  <re-button theme="primary" @click="showSmall = true">小画板</re-button>

<!-- 完整配置 -->
  <re-button theme="primary" @click="showFull = true">完整配置</re-button>
  <re-signature :visible="showDefault" @update:visible="showDefault = $event" />
  <re-signature :visible="showVisible" @update:visible="showVisible = $event" />
  <re-signature width="640rpx" height="480rpx" :visible="showSize" @update:visible="showSize = $event" />
  <re-signature lineColor="#0052d9" :visible="showLineColor" @update:visible="showLineColor = $event" />
  <re-signature backgroundColor="#f5f5f5" :visible="showBgColor" @update:visible="showBgColor = $event" />
  <re-signature :lineWidth="5" :visible="showLineWidth" @update:visible="showLineWidth = $event" />
  <re-signature width="400rpx" height="300rpx" :lineWidth="2" :visible="showSmall" @update:visible="showSmall = $event" />
  <re-signature width="640rpx" height="440rpx" :lineWidth="4" lineColor="#ff5500" backgroundColor="#fafafa" :visible="showFull" @update:visible="showFull = $event" />

引入

推荐使用 easycom 模式,配置后无需手动 import 即可直接使用 <re-signature />。

API

Signature Props

名称类型默认值描述必传
visiblebooleanfalse是否显示签名画板N
widthstring"300px"画板宽度N
heightstring"200px"画板高度N
lineWidthnumber3线条宽度N
lineColorstring"#333333"线条颜色N
backgroundColorstring"#ffffff"画板背景色N
customStylestring""自定义样式N

Signature Events

名称参数描述
confirmfilePath: string确认时触发
clear-清空时触发
close-关闭时触发
update:visiblevalue: boolean显隐变化时触发

Signature Slots

名称描述
--