更新记录
0.2.0(2026-09-05)
下载此版本
- 新增
centerClickable:中间区域(default 插槽)可接收点击;仅 Web / 小程序需要开启(#ifndef APP-ANDROID || APP-IOS || APP-HARMONY 下 pointer-events: auto),App 端无 pointer-events 限制无需处理
- 修复 App(含蒸汽)组件隔离下
type="primary" 时 CSS 变量失效:背景色与反白文字改用内联 var(--nax-color-*,fallback) 字符串兜底(#ifdef APP-ANDROID || APP-IOS || APP-HARMONY),其它端行为不变
0.1.6(2026-08-18)
下载此版本
- 蒸汽模式兼容:
lines CSS 声明迁移为 <text> 的 :max-lines 属性(官方蒸汽模式方案),消除 Vapor 运行时与 CSS 编译器警告
0.1.4(2026-08-14)
下载此版本
- readme 统一主题小节:通过 CSS 变量覆盖表格(button 风格),补充组件可覆盖的主题 Token
查看更多
平台兼容性
uni-app x(4.25)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| √ |
√ |
√ |
√ |
√ |
√ |
其他
# nax-nav-bar
自定义顶部导航栏(需页面 navigationStyle: custom)。面向 uni-app x:状态栏安全区、fixed 占位、返回栈兜底、微信小程序胶囊预留。
用法
<template>
<view class="page">
<nax-nav-bar title="页面标题" home-url="/pages/index/index" />
<view class="body">
<!-- 页面内容;fixed 默认会插入占位 -->
</view>
</view>
</template>
pages.json:
{
"path": "pages/demo/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
}
自定义右侧
<nax-nav-bar title="详情">
<template #right>
<nax-icon name="search" size="22" @click="onSearch" />
</template>
</nax-nav-bar>
仅事件、不自动返回
<nax-nav-bar title="编辑" :auto-back="false" @back="onBack" />
Props
| 属性 |
类型 |
默认 |
说明 |
| title |
string |
'' |
标题 |
| showBack |
boolean |
true |
是否显示返回区 |
| backText |
string |
'' |
返回文案 |
| backIcon |
string |
'chevron-left' |
返回图标(nax-icon);空串不显示图标 |
| backIconColor |
string |
'' |
返回图标颜色;空串时跟随导航栏 type / 主题 |
| autoBack |
boolean |
true |
点击返回是否自动 navigateBack |
| homeUrl |
string |
'' |
栈底无法返回时 reLaunch 目标 |
| fixed |
boolean |
true |
是否固定顶部 |
| placeholder |
boolean |
true |
fixed 且非 immersive 时是否占位 |
| immersive |
boolean |
false |
沉浸:fixed 不占位,背景透明 |
| border |
boolean |
true |
底部分割线(primary/immersive 默认无) |
| safeAreaInsetTop |
boolean |
true |
顶部状态栏安全区 |
| type |
string |
'default' |
default / primary |
| height |
string |
'44' |
内容行高度(px;支持 sm/md/lg) |
| zIndex |
number |
980 |
fixed 层级 |
| titleAlign |
string |
'center' |
center / left |
| centerClickable |
boolean |
false |
中间区域(default 插槽)可接收点击;仅 Web/小程序需开启(App 端无 pointer-events 限制) |
| show |
boolean |
true |
是否显示 |
| customClass |
string |
'' |
根扩展 class |
事件
| 事件 |
参数 |
说明 |
| back |
— |
点击返回;autoBack 为 true 时仍会触发后再导航 |
插槽
| 插槽 |
说明 |
| left |
左侧扩展(位于返回按钮右侧) |
| default |
中间自定义(覆盖 title);Web/小程序下需 center-clickable 才能接收点击 |
| right |
右侧操作区 |
主题
通过 CSS 变量覆盖:
| Token |
用途 |
--nax-color-bg |
背景色 |
--nax-color-border |
边框色 |
--nax-color-primary |
主题主色 |
--nax-color-text |
主文字色 |
--nax-color-text-inverse |
反白文字色 |
依赖
nax-icon
nax-ui-theme(可选,提供统一 token)
注意
- 页面必须
navigationStyle: custom,否则会与系统导航栏叠层。
- 微信小程序会为右侧预留胶囊宽度;其它小程序无胶囊 API 时不做错误 margin。
- 首页 / tab 页通常设
show-back=false,或配置 home-url 作为栈底出口。
- Web/小程序端中间插槽默认不接收点击(
pointer-events: none),需开启 center-clickable 并在插槽内容上自行绑定 @click;App 端无此限制。