该插件是横屏签名插件, 修改后的插件已经的可以拿来就是用的状态,增加了显示功能,先上效果图


下面介绍代码:1.首先是插件本身,建议复制代码到common中使用。
<template>
<!--
签名组件
LYH
横屏组件
-->
<view class="signa">
<view class="btn">
<view class="cancel-btn" @click="clear">
<span class="iconfont" style="margin-right: 10px;"></span>
重写
</view>
<view class="save-btn" @click="save">
<span class="iconfont" style="margin-right: 10px;"></span>
保存
</view>
<view class="cancel-bth" @click="colse">
<span class="iconfont" style="margin-right: 10px;"></span>
关闭
</view>
</view>
<canvas class="canvas" disable-scroll="true" :style="{'width':width,'height':height}" canvas-id="designature" @touchstart="starts"
@touchmove="moves" @touchend="end"></canvas>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
dom: null,
line: [],
radius: 0,
width: '0px',
height: '0px',
}
},
onLoad() {
},
computed:{
},
created() {
uni.getSystemInfo({
success: (res) => {
this.width = res.windowWidth - 60 + 'px';
this.height = res.windowHeight - 15 + 'px';
}
});
this.dom = uni.createCanvasContext('designature',this);
},
onShow(){
},
methods: {
end(e) {
},
distance(a, b) {
let x = b.x - a.x;
let y = b.y - a.y;
return Math.sqrt(x * x + y * y)

本文详细介绍了如何创建并使用一个横屏签名插件,包括插件的代码结构、功能实现以及在引用页面的配置。插件提供开始、结束、清除和保存签名操作,支持显示和触屏事件处理。通过引入和设置,可以在手机端实现完美适配的签名功能。
最低0.47元/天 解锁文章
1763

被折叠的 条评论
为什么被折叠?



