From 660d52fdf7e1d8012f3a35776609c76d53d0e6dd 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:12:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/custom.vue | 7 ++++--- components/diy/modules/custom/model-custom-group.vue | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/diy/custom.vue b/components/diy/custom.vue index 4f0a8f1e..4592e66f 100644 --- a/components/diy/custom.vue +++ b/components/diy/custom.vue @@ -204,23 +204,24 @@ const data_spacing = ['vertical', 'horizontal'].includes(new_form.data_source_direction) ? new_style.column_gap * (carousel_col - 1) : 0; // 自定义组件宽度 const width = sys_width - outer_spacing - content_spacing - internal_spacing - data_spacing - this.propOuterContainerPadding; - const new_data_style = !isEmpty(new_style.data_style) ? new_style.data_style : this.old_data_style; const new_data_content_style = !isEmpty(new_style.data_content_style)? new_style.data_content_style : this.old_data_style; // 判断是平移还是整屏滚动 const { padding_top = 0, padding_bottom = 0, margin_bottom = 0, margin_top = 0 } = new_data_style; let swiper_height = 0; - // 商品数量大于列数的时候,高度是列数,否则是当前的数量 - const col = new_list.length > carousel_col ? carousel_col : new_list.length; const scale_number = width / 390; const new_scale = scale_number > 0 ? scale_number : 0; // 间距 const space_between = new_form.data_source_direction == 'horizontal' ? new_style.column_gap : new_style.row_gap; + let col = Number(new_form.data_source_carousel_col); // 轮播图高度控制 if (new_form.data_source_direction == 'horizontal') { swiper_height = new_form.height * new_scale + padding_top + padding_bottom + margin_bottom + margin_top; } else { + // 商品数量大于列数的时候,高度是列数,否则是当前的数量 + col = new_list.length > carousel_col ? carousel_col : new_list.length; swiper_height = (new_form.height * new_scale + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((Number(new_form.data_source_carousel_col) - 1) * space_between); + } // 计算间隔的空间。(gap * gap数量) / 模块数量 let gap = (new_style.column_gap * (carousel_col - 1)) / carousel_col; diff --git a/components/diy/modules/custom/model-custom-group.vue b/components/diy/modules/custom/model-custom-group.vue index b3bb55d8..0aabc6fe 100644 --- a/components/diy/modules/custom/model-custom-group.vue +++ b/components/diy/modules/custom/model-custom-group.vue @@ -203,14 +203,15 @@ // 判断是平移还是整屏滚动 const { padding_top = 0, padding_bottom = 0, margin_bottom = 0, margin_top = 0 } = new_data_style; let swiper_height = 0; - // 商品数量大于列数的时候,高度是列数,否则是当前的数量 - const col = new_list.length > carousel_col ? carousel_col : new_list.length; + let col = Number(new_form.data_source_carousel_col); // 间距 const space_between = new_form.data_source_direction == 'horizontal' ? new_style.column_gap : new_style.row_gap; // 轮播图高度控制 if (new_form.data_source_direction == 'horizontal') { swiper_height = this.propDataHeight * custom_scale + padding_top + padding_bottom + margin_bottom + margin_top; } else { + // 商品数量大于列数的时候,高度是列数,否则是当前的数量 + col = new_list.length > carousel_col ? carousel_col : new_list.length; swiper_height = (this.propDataHeight * custom_scale + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((Number(new_form.data_source_carousel_col) - 1) * space_between); } // 计算间隔的空间。(gap * gap数量) / 模块数量