qa-regulatory-gwj-app/uni_modules/lime-signature/components/lime-signature/lime-signature.vue

63 lines
1.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<view style="width: 750rpx; height: 950rpx;">
<l-signature disableScroll backgroundColor="#000" ref="signatureRef" :penColor="penColor" :penSize="penSize"
:minLineWidth="2" :openSmooth="openSmooth"></l-signature>
</view>
<!-- <uni-popup ref="popup" type="bottom">
<l-signature v-if="show" beforeDelay="1000" disableScroll backgroundColor="#000" ref="signatureRef2" :penColor="penColor"
:penSize="penSize" :minLineWidth="2" :openSmooth="openSmooth"></l-signature>
</uni-popup> -->
<view>
<!-- <button @click="open"></button> -->
<button @click="onClick('clear')"></button>
<button @click="onClick('undo')"></button>
<button @click="onClick('save')"></button>
<button @click="onClick('openSmooth')">{{openSmooth?'':''}}</button>
</view>
<image :src="url" v-if="url" mode="widthFix"></image>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
penColor: 'red',
penSize: 16,
url: '',
show: false,
openSmooth: true,
bottomHeight: 0,
customBar: this.CustomBar || 0,
}
},
methods: {
open() {
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open()
this.show = true
},
onClick(type) {
if (type == 'openSmooth') {
this.openSmooth = !this.openSmooth
return
}
if (type == 'save') {
this.$refs.signatureRef.canvasToTempFilePath({
success: (res) => {
this.url = res.tempFilePath
}
})
return
}
if (this.$refs.signatureRef)
this.$refs.signatureRef[type]()
}
}
}
</script>
<style>
</style>