From bfb248a4ebe4c55b0ec923febc2f7dfc866c6cf2 Mon Sep 17 00:00:00 2001 From: maqian Date: Fri, 25 Jul 2025 15:16:20 +0800 Subject: [PATCH] =?UTF-8?q?ui(custom):=20tabbar=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/sp-tabbar/index.js | 93 ++++++++++++++++------------- src/components/sp-tabbar/index.scss | 3 + 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/components/sp-tabbar/index.js b/src/components/sp-tabbar/index.js index 2a841ccba..1414e90d4 100755 --- a/src/components/sp-tabbar/index.js +++ b/src/components/sp-tabbar/index.js @@ -80,52 +80,59 @@ function SpTabbar() { return ( - {tabList?.map((item, index) => ( - handleTabbarClick(index)}> - {/* {index == 0 && - (index !== currentIndex ? ( - <> - - - {item.text} + {tabList?.map((item, index) => { + const iconPath = index == currentIndex ? item.selectedIconPath : item.iconPath + return ( + handleTabbarClick(index)}> + {/* {index == 0 && + (index !== currentIndex ? ( + <> + + + {item.text} + + + ) : ( + + ))} */} + + + {/^http/.test(iconPath) ? ( + + ) : ( + + )} + + {item.name == 'cart' && cartCount > 0 && ( + 99 ? '1' : ''}`}> + {cartCount > 0 && cartCount <= 99 && ( + {cartCount} + )} + {cartCount > 99 && 99+} - - ) : ( - - ))} */} + )} + - - - - {item.name == 'cart' && cartCount > 0 && ( - 99 ? '1' : ''}`}> - {cartCount > 0 && cartCount <= 99 && ( - {cartCount} - )} - {cartCount > 99 && 99+} - - )} + + {item.text} + - - - {item.text} - - - ))} + ) + })} ) } diff --git a/src/components/sp-tabbar/index.scss b/src/components/sp-tabbar/index.scss index 60f434c20..f2e50c8d3 100755 --- a/src/components/sp-tabbar/index.scss +++ b/src/components/sp-tabbar/index.scss @@ -79,6 +79,9 @@ } &-image-wrapper { position: relative; + .iconfont { + font-size: 56px; + } } &-image { // position: relative;