From 08293737e1ec22e4763c61ef661262a9a06e4a78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 21 Feb 2025 11:45:10 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E6=9C=AC=E5=AE=BD?=
=?UTF-8?q?=E9=AB=98=E8=87=AA=E5=AE=9A=E4=B9=89=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../custom-module/custom-location/index.vue | 24 ++++++++------
.../common/custom-module/model-text/index.vue | 31 ++++++++++++++++---
.../model-text/model-text-style.vue | 24 +++++++++++---
.../model-custom/components/index-default.ts | 2 ++
.../model-custom/components/index.vue | 18 ++++++++++-
5 files changed, 80 insertions(+), 19 deletions(-)
diff --git a/src/components/common/custom-module/custom-location/index.vue b/src/components/common/custom-module/custom-location/index.vue
index 86158dfe..ccbb3ac4 100644
--- a/src/components/common/custom-module/custom-location/index.vue
+++ b/src/components/common/custom-module/custom-location/index.vue
@@ -19,10 +19,10 @@
-
+
-
+
@@ -37,20 +37,24 @@ const props = defineProps({
// 跟随内容
const data_follow = defineModel('follow', { type: Object, default: { follow_type: 'none', follow_id: '', follow_spacing: 0 }});
// x轴 Y轴设计
-const data_location = defineModel({ type: Object, default: () => ({ x: 0, y: 0, staging_y: 0 }) });
+const data_location = defineModel({ type: Object, default: () => ({ x: 0, y: 0, record_x: 0, record_y: 0, staging_y: 0 }) });
const emit = defineEmits(['operation_end']);
// 失去焦点时触发事件
const operation_end = () => {
emit('operation_end');
};
+// x轴变化时,更新记录的位置
+const location_x_change = (val: number) => {
+ data_location.value.record_x = val;
+}
+// y轴变化时,更新记录的位置
+const location_y_change = (val: number) => {
+ data_location.value.record_y = val;
+ data_location.value.staging_y = val
+};
// 跟随id发生变化时的处理
const follow_id_change = () => {
-
+ emit('operation_end');
+
}
-// 监听y轴
-watch(() => data_location.value.y, (val) => {
- if (val !== data_location.value.staging_y) {
- data_location.value.staging_y = val;
- }
-});
\ No newline at end of file
diff --git a/src/components/common/custom-module/model-text/index.vue b/src/components/common/custom-module/model-text/index.vue
index 5185d1dd..2befca40 100644
--- a/src/components/common/custom-module/model-text/index.vue
+++ b/src/components/common/custom-module/model-text/index.vue
@@ -1,5 +1,5 @@
-
+
@@ -205,14 +205,37 @@ const set_count = () => {
if (props.isDisplayPanel) {
return '';
} else {
- const { com_width = 0, com_height = 0, is_width_auto = '0', is_height_auto = '0'} = form.value;
- return `${ is_width_auto == '1' ? `width:100%;max-width: ${ com_width }px;` : `width:${ com_width }px;`}${ is_height_auto == '1' ? `height:100%;max-height: ${ com_height }px;` : `height: ${ com_height }px;` }`;
+ const { com_width = 0, com_height = 0, is_width_auto = '0', is_height_auto = '0', max_width = 0, max_height = 0} = form.value;
+ const new_max_width = max_width > 0 ? `max-width: ${ max_width }px;` : 'white-space: nowrap;';
+ const new_max_height = max_height > 0 ? `max-height: ${ max_height }px;` : '';
+ return `${ is_width_auto == '1' ? `width:100%;${ new_max_width }` : `width:${ com_width }px;`}${ is_height_auto == '1' ? `height:100%;${ new_max_height }` : `height: ${ com_height }px;` }`;
}
};
+const emits = defineEmits(['container_change']);
+// 开启自定义的时候重新计算高度和宽度
+const modelText = ref(null);
+watch(() => form.value, (value) => {
+ const { is_width_auto = '0', is_height_auto = '0', max_width = 0, max_height = 0 , com_width = 0, com_height = 0} = form.value;
+ let new_width = com_width;
+ let new_height = com_height;
+ // 宽度自适应时 获取当前容器的宽度
+ if (is_width_auto == '1') {
+ new_width = modelText.value?.clientWidth || 0;
+ }
+ // 高度自适应时时 获取当前容器的高度
+ if (is_height_auto == '1') {
+ new_height = modelText.value?.clientHeight || 0;
+ }
+ // 如果跟历史的宽度或者高度不同,则更新
+ if (new_width !== com_width && new_height !== com_height) {
+ emits('container_change', new_width, new_height)
+ }
+}, { deep: true });
+