ke: 鸿蒙导航纯图标 + 图标加大 + 玻璃几何令牌

用户反馈:① 图标太小 ② 底部导航栏不允许有文字。

- NavItem(底部导航):去掉 Text(item.label) 纯图标,AmIcon 22→28vp
- WideSidebar(宽屏侧栏):去掉 label 文字(WebUI Sidebar 本就是 60px 纯图标轨),
  导航图标 22→26vp、品牌标 26→30vp;NavItemBuilder 去掉 label 参数
- Theme:新增 glassRadius=14 / paneGap=10(与 WebUI app-shell CSS 变量同值,
  用于宽屏玻璃面板几何;原有 radiusCard 保持系统跟随不动)
- 判据同步:harmony-nav ⑤ 改纯图标(1 处三元式 + 无文字 + 28vp)+ 变异自检三项;
  harmony-widescreen ③ 同样改纯图标(1 处 + 无文字 + 26vp)
This commit is contained in:
2026-09-16 07:54:44 +08:00
parent cfe7808af4
commit fd4b475920
5 changed files with 68 additions and 47 deletions

View File

@ -50,14 +50,23 @@ test('② 三项导航 + 设置按钮:内容与 WebUI Sidebar 对齐', () => {
assert.match(sidebar, /onSettings/, '设置按钮要回调 onSettings(点击后由 MainPage 路由)');
});
test('③ 选中态只换颜色(与底部导航同一套纪律)', () => {
test('③ 选中态只换颜色(与底部导航同一套纪律):纯图标、无文字', () => {
const sidebar = read('pages/WideSidebar.ets');
const code_ = stripComments(sidebar);
// 图标与文字都过同一个选中三元式
/*
* 2026-09-16 用户:「底部导航栏不允许有文字」⇒ 侧栏同样走纯图标。
* WebUI 的 `Sidebar.tsx` 本就是 60px 纯图标轨(无 label 文字)。
*/
const active = /this\.currentIndex === index \? Theme\.navFgActive : Theme\.navFg/g;
const hits = code_.match(active) || [];
assert.equal(hits.length, 2,
`图标与文字都要过同一个选中三元式(现在 ${hits.length} 处)`);
assert.equal(hits.length, 1,
`侧栏导航项只应有 1 处选中三元式(现在 ${hits.length} 处)— 纯图标,无文字`);
// 无文字(label 的 Text)
assert.ok(!/Text\(label\)/.test(code_),
'侧栏是纯图标轨:不允许有 label 文字(WebUI Sidebar 无文字)');
// 图标不能太小(26vp)
assert.match(code_, /iconSize: 26/,
'侧栏导航图标要 26vp(WebUI 是 24,鸿蒙放大一档 —— 用户嫌 22 太小)');
// 不加背景块 / 指示条
assert.ok(!/currentIndex[^{;]{0,40}backgroundColor/.test(code_),
'选中态不许改背景色(与底部导航同一纪律:变色即可)');