From 9f77f26bad9c1438b816bfac43d36186ac6aed3e 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, 10 Jan 2025 15:57:20 +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=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model-data-magic/components/custom/index.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/model-data-magic/components/custom/index.vue b/src/components/model-data-magic/components/custom/index.vue index 8e428647..c2f019c2 100644 --- a/src/components/model-data-magic/components/custom/index.vue +++ b/src/components/model-data-magic/components/custom/index.vue @@ -213,17 +213,18 @@ watchEffect(() => { const carousel_col = Number(form.value?.data_source_carousel_col) || 1; // 判断是平移还是整屏滚动 slides_per_group.value = new_style.value.rolling_fashion == 'translation' ? 1 : carousel_col; - // 商品数量大于列数的时候,高度是列数,否则是当前的数量 - const col = data_source_content_list.value.length > carousel_col ? carousel_col : data_source_content_list.value.length; - // 一屏显示的数量 - slides_per_view.value = col; const { margin_bottom, margin_top } = new_style.value.data_chunk_margin; const { padding_top, padding_bottom } = new_style.value.data_chunk_padding; // 轮播图高度控制 - if (form.value.data_source_direction == '2') { + if (form.value.data_source_direction == 'horizontal') { swiper_height.value = form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top; + slides_per_view.value = Number(carousel_col); } else { + // 商品数量大于列数的时候,高度是列数,否则是当前的数量 + const col = data_source_content_list.value.length > carousel_col ? carousel_col : data_source_content_list.value.length; swiper_height.value = (form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((carousel_col - 1) * space_between.value); + // 一屏显示的数量 + slides_per_view.value = col; } // 更新轮播图的key,确保更换时能重新更新轮播图 carouselKey.value = get_math();