Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-06-17 10:37:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6a7ac57392d21b64ab8595df979492ecc60ae38b
6a7ac573
1 parent
02c793b3
fix 签名组件有默认值时不同情况处理优化
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
src/components/SignField/MyComponent.vue
src/components/SignField/MyComponent.vue
View file @
6a7ac57
<!--
* @Date: 2023-03-29 17:44:24
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-
06 17:50:41
* @LastEditTime: 2024-06-
17 10:34:10
* @FilePath: /data-table/src/components/SignField/MyComponent.vue
* @Description: 文件描述
-->
<template>
<div style="width: 100%;">
<div v-
if="!readonly
" ref="wrapperRef" class="esign-wrapper">
<div v-
show="!default_value
" ref="wrapperRef" class="esign-wrapper">
<vue-esign v-if="esignWidth" ref="esign" class="sign-wrapper" :width="esignWidth" :height="esignHeight" :isCrop="isCrop"
:lineWidth="lineWidth" :lineColor="lineColor" :bgColor.sync="bgColor" />
<div v-if="show_sign" class="whiteboard">
...
...
@@ -16,7 +16,7 @@
</div>
</div>
</div>
<div v-
else
class="esign-wrapper">
<div v-
show="default_value"
class="esign-wrapper">
<div class="sign-wrapper">
<van-image
width="100%"
...
...
@@ -72,17 +72,24 @@ const wrapperRef = ref(null);
const readonly = ref(false);
const default_value = ref('');
onMounted(() => {
// 只读状态
if (props.component_props.readonly) {
readonly.value = props.component_props.readonly
}
// 非只读,有默认值
if (props.component_props.default) {
default_value.value = props.component_props.default?.url
default_value.value = props.component_props.default?.url
;
}
if (!props.component_props.readonly) {
show_sign.value = false;
show_control.value = false;
} else { // 有默认值的话不要先计算宽高,删除默认值,影响后期生成
// 动态计算画板canvas宽度/高度
setTimeout(() => {
esignWidth.value = wrapperRef?.value?.offsetWidth - 32;
esignHeight.value = (window.innerHeight) / 5;
}, 100);
}
})
const lineWidth = ref(6);
const lineColor = ref("#000000");
...
...
@@ -97,10 +104,17 @@ const sign_value = computed(() => {
const handleReset = () => {
// 清空画板
esign.value.reset();
esign.value
?
.reset();
show_control.value = true;
// 删除可能存在的签名
image_url.value = "";
// 删除默认值
default_value.value = "";
// 动态计算画板canvas宽度/高度
setTimeout(() => {
esignWidth.value = wrapperRef?.value?.offsetWidth - 32;
esignHeight.value = (window.innerHeight) / 5;
}, 100);
};
/********** 上传七牛云获取图片地址 ***********/
...
...
Please
register
or
login
to post a comment