From ffbead8c020e40520cbba8dc33542f8628cbcabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Wed, 8 Jan 2025 16:13:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=BD=AE=E6=92=AD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/custom-module/model-custom-group/index.vue | 7 ++++--- src/components/model-custom/index.vue | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/common/custom-module/model-custom-group/index.vue b/src/components/common/custom-module/model-custom-group/index.vue index 65802d63..bd03ab19 100644 --- a/src/components/common/custom-module/model-custom-group/index.vue +++ b/src/components/common/custom-module/model-custom-group/index.vue @@ -190,9 +190,6 @@ watchEffect(() => { const data_source_carousel_col = Number(form.value.data_source_carousel_col); // 判断是平移还是整屏滚动 slides_per_group.value = new_style.value.rolling_fashion == 'translation' ? 1 : Number(data_source_carousel_col); - // 商品数量大于列数的时候,高度是列数,否则是当前的数量 - const col = data_source_content_list.value.length > Number(data_source_carousel_col) ? Number(data_source_carousel_col) : data_source_content_list.value.length; - slides_per_view.value = col; let num = 0; // 轮播图数量 if (!isEmpty(data_source_content_list.value)) { @@ -202,7 +199,11 @@ watchEffect(() => { // 轮播图高度控制 if (form.value.data_source_direction == 'horizontal') { swiper_height.value = props.dataHeight * custom_scale.value + padding_top + padding_bottom + margin_bottom + margin_top; + slides_per_view.value = Number(data_source_carousel_col); } else { + // 商品数量大于列数的时候,高度是列数,否则是当前的数量 + const col = data_source_content_list.value.length > Number(data_source_carousel_col) ? Number(data_source_carousel_col) : data_source_content_list.value.length; + slides_per_view.value = col; swiper_height.value = (props.dataHeight * custom_scale.value + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((data_source_carousel_col - 1) * space_between.value); } dot_list.value = Array(num); diff --git a/src/components/model-custom/index.vue b/src/components/model-custom/index.vue index fde55909..419951bd 100644 --- a/src/components/model-custom/index.vue +++ b/src/components/model-custom/index.vue @@ -169,9 +169,6 @@ watchEffect(() => { const data_source_carousel_col = Number(form.value.data_source_carousel_col); // 判断是平移还是整屏滚动 slides_per_group.value = new_style.value.rolling_fashion == 'translation' ? 1 : Number(data_source_carousel_col); - // 商品数量大于列数的时候,高度是列数,否则是当前的数量 - const col = data_source_content_list.value.length > Number(data_source_carousel_col) ? Number(data_source_carousel_col) : data_source_content_list.value.length; - slides_per_view.value = col; let num = 0; // 轮播图数量 if (!isEmpty(data_source_content_list.value)) { @@ -181,8 +178,12 @@ watchEffect(() => { // 轮播图高度控制 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(data_source_carousel_col); } else { + // 商品数量大于列数的时候,高度是列数,否则是当前的数量 + const col = data_source_content_list.value.length > Number(data_source_carousel_col) ? Number(data_source_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 + ((data_source_carousel_col - 1) * space_between.value); + slides_per_view.value = col; } dot_list.value = Array(num); // 更新轮播图的key,确保更换时能重新更新轮播图