first commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div id="canvas" style="position: relative;border: 1px dashed #d5d2d2;width: 100%">
|
||||
<van-button plain type="danger" hairline size="small" class="clearBtn" @click="reset">清空重签</van-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
module.exports = {
|
||||
props: {
|
||||
my_sign: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
$('#canvas').jSignature('reset')
|
||||
this.$emit("update:my_sign", null)
|
||||
},
|
||||
checkNull() {
|
||||
return $('#canvas').jSignature('getData', 'native').length === 0
|
||||
},
|
||||
submitSign() {
|
||||
this.$emit("update:my_sign", $('#canvas').jSignature('getData'))
|
||||
},
|
||||
async updateSign() {
|
||||
const data = await $.post("/mobile/common/signing/update", {sign: $('#canvas').jSignature('getData')})
|
||||
},
|
||||
async getMySign() {
|
||||
const data = await $.get("/mobile/common/signing/getMySign")
|
||||
if (data) {
|
||||
console.log(this.my_sign)
|
||||
|
||||
$('#canvas').jSignature("importData", data)
|
||||
this.$nextTick(() => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getMySign()
|
||||
},
|
||||
async mounted() {
|
||||
$("#canvas").jSignature({
|
||||
width: '100%',
|
||||
height: 300,
|
||||
"decor-color": "transparent",
|
||||
lineWidth: '3'
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.clearBtn {
|
||||
position: absolute !important;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
color: red;
|
||||
z-index: 99;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user