feat: 自定义导航左侧可配置显隐,分类页隐藏左侧 (ECX-8066)

Made-with: Cursor
This commit is contained in:
zhangjing1
2026-03-06 15:57:40 +08:00
parent 48c0f1ad09
commit ca31189da8
6 changed files with 14 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
# 2026-03-06 | ECX-8066 | 首页 body 高度计算方式调整
# 2026-03-06 | ECX-8066 | 自定义导航左侧可配置显隐及分类页隐藏左侧
- **说明**首页 onReady 中 body 高度由直接使用 SpPage 传入的 height 改为使用 `calc(100vh - gNavbarH - footerHeight)` 计算,与导航栏、底栏高度对齐,避免高度偏差
- **涉及**`src/pages/index.js`
- **类型**refactor
- **说明**SpPage 支持通过 `showNavitionLeft` 控制自定义导航左侧区域(返回/首页/功能区)是否展示;分类页、分类加购页传入 `showNavitionLeft={false}` 隐藏左侧,标题区无左侧时增加左内边距;导航区 padding 微调(左 30→20px右 10→20px
- **涉及**`src/components/sp-page/header.js``src/components/sp-page/index.js``src/components/sp-page/index.scss``src/pages/category/index.js``src/pages/category/comps/comps-category-addCart.js`
- **类型**feat

View File

@@ -26,7 +26,8 @@ const CustomNavigationHeader = memo((props) => {
onNearbyClick,
onSearchConfirm,
nearbyText,
navigationRSpace
navigationRSpace,
showNavitionLeft
} = props
const value = pageConfig
@@ -202,7 +203,7 @@ const CustomNavigationHeader = memo((props) => {
className={classNames('header-container', { 'has-nearby': hasNearby })}
style={styleNames({ width: `calc(100% - ${navigationRSpace}px)`,...(showHeaderContent ? containerStyle() : {})})}
>
<View className='header-container-left' style={styleNames({ width: `${navigationRSpace}px` })}>
{showNavitionLeft && <View className='header-container-left' style={styleNames({ width: `${navigationRSpace}px` })}>
{/* 左侧:返回、首页、功能区三者只显示一个 */}
{showHeaderContent && showFunctionArea ? (
<>
@@ -224,8 +225,8 @@ const CustomNavigationHeader = memo((props) => {
)}
</>
)}
</View>
<View className='title-container'>
</View>}
<View className='title-container' style={styleNames({ paddingLeft: !showNavitionLeft ? `20rpx` : `0` })}>
{/* 标题区:搜索 */}
{showHeaderContent && titleStyle === '3' && renderSearch()}
{/* 标题区:页面名称 */}

View File

@@ -321,6 +321,7 @@ const SpPage = memo(
nearbyText={props.nearbyText}
onSearchConfirm={props.onSearchConfirm}
navigationRSpace={state.navigationRSpace}
showNavitionLeft={props.showNavitionLeft}
/>
)}
{props.isDefault &&

View File

@@ -9,7 +9,7 @@
display: flex;
align-items: center;
box-sizing: border-box;
padding-left: 30px;
padding-left: 20px;
padding-right: 20px;
}
.title-container {
@@ -203,7 +203,7 @@
margin-left: 0;
position: relative;
z-index: 2;
padding-right: 10px;
padding-right: 20px;
box-sizing: border-box;
.search-container {

View File

@@ -374,6 +374,7 @@ function CompsCategoryAddCart(props) {
<SpPage
scrollToTopBtn
className={classNames('page-category-index-old')}
showNavitionLeft={false}
ref={pageRef}
onReady={(e) => {
console.log('onReady', e)

View File

@@ -68,6 +68,7 @@ function StoreItemList(props) {
renderFooter={<SpTabbar />}
onReady={handlePageReady}
showpoweredBy={false}
showNavitionLeft={false}
>
<View
className='page-category__container'