Showing
1 changed file
with
22 additions
and
4 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-03-29 17:44:24 | 2 | * @Date: 2023-03-29 17:44:24 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-06-29 19:06:27 | 4 | + * @LastEditTime: 2024-06-06 17:50:41 |
| 5 | * @FilePath: /data-table/src/components/SignField/MyComponent.vue | 5 | * @FilePath: /data-table/src/components/SignField/MyComponent.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div style="width: 100%;"> | 9 | <div style="width: 100%;"> |
| 10 | - <div ref="wrapperRef" class="esign-wrapper"> | 10 | + <div v-if="!readonly" ref="wrapperRef" class="esign-wrapper"> |
| 11 | <vue-esign v-if="esignWidth" ref="esign" class="sign-wrapper" :width="esignWidth" :height="esignHeight" :isCrop="isCrop" | 11 | <vue-esign v-if="esignWidth" ref="esign" class="sign-wrapper" :width="esignWidth" :height="esignHeight" :isCrop="isCrop" |
| 12 | :lineWidth="lineWidth" :lineColor="lineColor" :bgColor.sync="bgColor" /> | 12 | :lineWidth="lineWidth" :lineColor="lineColor" :bgColor.sync="bgColor" /> |
| 13 | <div v-if="show_sign" class="whiteboard"> | 13 | <div v-if="show_sign" class="whiteboard"> |
| ... | @@ -16,6 +16,16 @@ | ... | @@ -16,6 +16,16 @@ |
| 16 | </div> | 16 | </div> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | + <div v-else class="esign-wrapper"> | ||
| 20 | + <div class="sign-wrapper"> | ||
| 21 | + <van-image | ||
| 22 | + width="100%" | ||
| 23 | + height="100%" | ||
| 24 | + :src="default_value" | ||
| 25 | + style="margin-right: 0.5rem; margin-block-end: 0.25rem;" | ||
| 26 | + /> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 19 | <div v-if="!show_sign"> | 29 | <div v-if="!show_sign"> |
| 20 | <div v-if="show_control" class="control-sign"> | 30 | <div v-if="show_control" class="control-sign"> |
| 21 | <van-row gutter="20" style="padding: 0 1rem"> | 31 | <van-row gutter="20" style="padding: 0 1rem"> |
| ... | @@ -58,11 +68,19 @@ const esign = ref(null); | ... | @@ -58,11 +68,19 @@ const esign = ref(null); |
| 58 | 68 | ||
| 59 | let esignWidth = ref(); | 69 | let esignWidth = ref(); |
| 60 | let esignHeight = ref(); | 70 | let esignHeight = ref(); |
| 61 | -const wrapperRef = ref(null) | 71 | +const wrapperRef = ref(null); |
| 72 | +const readonly = ref(false); | ||
| 73 | +const default_value = ref(''); | ||
| 62 | onMounted(() => { | 74 | onMounted(() => { |
| 75 | + if (props.component_props.readonly) { | ||
| 76 | + readonly.value = props.component_props.readonly | ||
| 77 | + } | ||
| 78 | + if (props.component_props.default) { | ||
| 79 | + default_value.value = props.component_props.default?.url | ||
| 80 | + } | ||
| 63 | // 动态计算画板canvas宽度/高度 | 81 | // 动态计算画板canvas宽度/高度 |
| 64 | setTimeout(() => { | 82 | setTimeout(() => { |
| 65 | - esignWidth.value = wrapperRef.value.offsetWidth - 32; | 83 | + esignWidth.value = wrapperRef?.value?.offsetWidth - 32; |
| 66 | esignHeight.value = (window.innerHeight) / 5; | 84 | esignHeight.value = (window.innerHeight) / 5; |
| 67 | }, 100); | 85 | }, 100); |
| 68 | }) | 86 | }) | ... | ... |
-
Please register or login to post a comment