tmp1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// 自定义 tabBar:原生 tabBar 只能放 PNG 位图,三个图标分别是
|
||||
// 实心"手托心" / 气泡里塞"AI"字 / 线框人形,风格互相打架。
|
||||
// 改用 TDesign 图标字体后,三个 tab 走同一套线性笔触,只靠颜色区分选中态。
|
||||
// 自定义 tabBar:固定在底部,选中态只换颜色、不换图形。
|
||||
// 「首页 / 我的」走 TDesign 线性图标字体;「AI客服」用品牌 AI 图标
|
||||
// (气泡内 AI 字位图):灰色版 ai.png 为未选中态,暖橙版 ai-ink.png 为选中态,
|
||||
// 与文字颜色同步切换,保持选中可辨
|
||||
Component({
|
||||
data: {
|
||||
selected: 0, // 当前选中项,由各 tab 页在 onShow 里同步
|
||||
@@ -13,7 +14,9 @@ Component({
|
||||
}, {
|
||||
pagePath: '/pages/ai/aichat',
|
||||
text: 'AI客服',
|
||||
icon: 'chat'
|
||||
// 图片图标:配置了 imgPath 时优先于 icon 渲染
|
||||
imgPath: '/images/ai.png',
|
||||
imgActivePath: '/images/ai-ink.png'
|
||||
}, {
|
||||
pagePath: '/pages/mine/mine',
|
||||
text: '我的',
|
||||
|
||||
@@ -7,8 +7,16 @@
|
||||
data-path="{{ item.pagePath }}"
|
||||
bindtap="onTap"
|
||||
>
|
||||
<!-- 三个 tab 共用同一套线性图标,选中态只换颜色、不换图形 -->
|
||||
<!-- 配置了 imgPath 的 tab(AI客服)走位图:灰色未选中 / 暖橙选中两态切换;
|
||||
其余 tab 走 TDesign 线性图标,选中态只换颜色 -->
|
||||
<image
|
||||
wx:if="{{ item.imgPath }}"
|
||||
class="tab-icon-img"
|
||||
src="{{ selected === index ? item.imgActivePath : item.imgPath }}"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<t-icon
|
||||
wx:else
|
||||
name="{{ item.icon }}"
|
||||
size="44rpx"
|
||||
color="{{ selected === index ? activeColor : inactiveColor }}"
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 位图图标(AI客服):与 t-icon 的 44rpx 视觉尺寸对齐 */
|
||||
.tab-icon-img {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
margin-top: 6rpx;
|
||||
/* 与全局约束一致:中文正文不小于 24rpx(12px) */
|
||||
|
||||
Reference in New Issue
Block a user