最近产品让我写个手写签名,上网百度了一下,基本上快速连笔都很卡,于是自己参考资料重写了一下,体验效果拉满,话不多说上代码。
WXML代码
<canvas type="2d" id="canvas" disable-scroll="true" bindtouchmove="handleMove" bindtouchstart="handleStart" binderror="handleError" style="width:{
{width}}px;height:{
{height}}px;"></canvas>
<view class="btn">
<button bindtap="clearClick">重签</button>
<button bindtap="saveClick">确认</button>
</view>
WXSS
page {
background-color: #e7e7e7;
}
.btn {
width: 100%;
display: flex;
justify-content: space-around;
align-items: center;
height: 60px;
position: fixed;
bottom: 0px;
}
.btn button {
color: #006ec7;
}
button {
width: 200rpx;
border-radius: 5rpx;
box-shadow: 0px 0p