From 8cab2b0871d3cdba96d21f37626d9bc9d2d58161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Tue, 5 Aug 2025 16:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/model-custom/index.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/model-custom/index.vue b/src/components/model-custom/index.vue index 2d046ca6..387d2122 100644 --- a/src/components/model-custom/index.vue +++ b/src/components/model-custom/index.vue @@ -78,6 +78,10 @@ const props = defineProps({ return {}; }, }, + magicScale: { + type: Number, + default: 1, + }, isCommonStyle: { type: Boolean, default: true, @@ -116,6 +120,7 @@ const scale = ref(1); // 计算整体宽度和比例 watchEffect(() => { const { common_style, data_style, data_content_style, column_gap } = new_style.value; + const new_width = 390 * props.magicScale; // 外层左右间距 const outer_spacing = common_style.margin_left + common_style.margin_right + common_style.padding_left + common_style.padding_right + border_width(common_style); // 内容左右间距 @@ -125,9 +130,9 @@ watchEffect(() => { // 数据间距 const data_spacing = ['vertical', 'horizontal'].includes(form.value.data_source_direction) ? column_gap * (form.value.data_source_carousel_col - 1) : 0; // 根据容器宽度来计算内部大小 - const width = 390 - outer_spacing - internal_spacing - content_spacing - data_spacing - props.outerContainerPadding; + const width = new_width - outer_spacing - internal_spacing - content_spacing - data_spacing - props.outerContainerPadding; // 获得对应宽度的比例 - const scale_number = width / 390; + const scale_number = width / new_width; scale.value = scale_number > 0 ? scale_number : 0; }); //#endregion