From 2ef3c014fb157343d6930443ba354ddc869434b7 Mon Sep 17 00:00:00 2001 From: zhangjing1 Date: Wed, 18 Mar 2026 15:19:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(ECX-8143):=20=E5=9B=BE=E7=89=87=E7=83=AD?= =?UTF-8?q?=E5=8C=BA=E7=BA=B5=E5=90=91=E6=A8=A1=E5=BC=8F=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E9=97=B4=E8=B7=9D=E4=B8=8E=20body=20=E5=AE=BD=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 纵向(vertical)时外层容器 width 使用 calc(100% - paddedr) 留出右侧间距 - 恢复 body 的 width/height 配置逻辑(imgWidth、imgHeight、base.imgHeight) Made-with: Cursor --- src/pages/home/wgts/imghot-zone/index.jsx | 29 ++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/pages/home/wgts/imghot-zone/index.jsx b/src/pages/home/wgts/imghot-zone/index.jsx index 25eacf2db..8f9fdab46 100644 --- a/src/pages/home/wgts/imghot-zone/index.jsx +++ b/src/pages/home/wgts/imghot-zone/index.jsx @@ -33,33 +33,30 @@ function WgtImgHotZone(props) { // 获取外层样式(包含 outerMargin 和背景配置) const outerStyle = useMemo(() => { const style = getGlobalBaseStyle(base.outerMargin) - - // 纵向布局时,外层容器高度优先使用 base.imgHeight - if (isVertical && base.imgHeight) { - style.height = Taro.pxTransform(base.imgHeight) + if (isVertical) { + const pr = base.outerMargin?.paddedr + style.width = `calc(100% - ${Taro.pxTransform(pr)})` } - return style }, [base, isVertical]) // 容器样式(图片容器) const bodyStyle = useMemo(() => { const style = { - // width: config.imgWidth ? Taro.pxTransform(config.imgWidth) : undefined + width: config.imgWidth ? Taro.pxTransform(config.imgWidth) : '100%' } // 纵向布局时,优先使用 base.imgHeight - // if (isVertical && base.imgHeight) { - // style.height = Taro.pxTransform(base.imgHeight) - // } else if (config.imgHeight) { - // // 横向布局时,使用 config.imgHeight - // style.height = Taro.pxTransform(config.imgHeight) - // } else { - // style.height = 'auto' - // } - style.height = 'auto' + if (isVertical && base.imgHeight) { + style.height = Taro.pxTransform(base.imgHeight) + } else if (config.imgHeight) { + // 横向布局时,使用 config.imgHeight + style.height = Taro.pxTransform(config.imgHeight) + } else { + style.height = 'auto' + } return style - }, [config.imgWidth, config.imgHeight, isVertical, base.imgHeight]) + }, [config.imgWidth, config.imgHeight, isVertical, base.imgHeight, base.outerMargin]) // 点击处理 const handleClickItem = async (item) => {