更新记录
0.2.0(2026-09-04)
下载此版本
text prop 支持 number 类型([String, Number]):数字文案直接渲染(含 0),price / date 模式同样适用(数字时间戳字符串化后由 parseFloat 解析);hasText / displayValue / 拨号场景补齐 number 与 undefined 兜底
0.1.17(2026-08-18)
下载此版本
- 蒸汽模式兼容:移除
.nax-text__value--lines-1 中已废弃的 lines: 1 声明(仅 VDOM 支持,Vapor 下告警,App 三端与 Web/小程序两处条件编译分支均迁移),行数限制由 <text> 的 :max-lines="lines" 属性承担
0.1.15(2026-08-14)
下载此版本
- readme 统一主题小节:通过 CSS 变量覆盖表格(button 风格),补充组件可覆盖的主题 Token
查看更多
平台兼容性
uni-app x(4.25)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
| √ |
√ |
√ |
√ |
√ |
√ |
其他
nax-text
uni-app x 文本组件。
主题
通过 CSS 变量覆盖:
| Token |
用途 |
--nax-color-error |
错误色 |
--nax-color-info |
信息色 |
--nax-color-primary |
主题主色 |
--nax-color-success |
成功色 |
--nax-color-text |
主文字色 |
--nax-color-text-placeholder |
占位文字色 |
--nax-color-text-secondary |
次要文字色 |
--nax-color-warning |
警告色 |
依赖
nax-icon(前/后缀图标)
nax-ui-theme(CSS 变量 --nax-*,弱依赖)
基础用法
<nax-text text="这是多行输入啊"></nax-text>
<nax-text type="primary" text="主题色"></nax-text>
<nax-text mode="price" text="128.5" type="error"></nax-text>
<nax-text mode="phone" format="encrypt" text="130xxxxxxxx"></nax-text>
<nax-text :lines="2" text="超出两行显示省略号……"></nax-text>
Props
| 属性 |
类型 |
默认 |
说明 |
| type |
string |
default |
default / primary / info / success / warning / error / secondary / placeholder |
| show |
boolean |
true |
是否显示 |
| text |
string / number |
'' |
文案(支持数字类型,如余额 688.5;price / date 模式同样适用) |
| prefix-icon |
string |
'' |
前置图标名(nax-icon) |
| suffix-icon |
string |
'' |
后置图标名 |
| mode |
string |
text |
text / price / phone / name / date / link |
| href |
string |
'' |
mode=link 链接 |
| format |
string |
'' |
phone/name 用 encrypt;date 用时间格式,默认 yyyy-mm-dd |
| call |
boolean |
false |
mode=phone 时点击拨号 |
| bold |
boolean |
false |
加粗 |
| block |
boolean |
false |
块级 |
| lines |
number |
0 |
最大行数,超出省略;0 不限制 |
| color |
string |
'' |
自定义颜色(优先于 type) |
| size |
string |
md |
sm(14) / md(16 默认) / lg(18) / xl(20) 或数字 px |
| decoration |
string |
none |
none / underline / line-through |
| align |
string |
left |
left / center / right |
| line-height |
string |
'' |
行高 |
| selectable |
boolean |
false |
是否可选中 |
| icon-size |
string |
'' |
图标尺寸,默认跟随字号 |
| icon-color |
string |
'' |
图标颜色 |
| custom-class |
string |
'' |
根节点扩展 class |
Events
| 事件 |
说明 |
| click |
点击;phone+call 会拨号,link 会打开/复制链接 |
插槽
| 名称 |
说明 |
| default |
文案后的附加内容 |
| prefix |
自定义前置区域 |
| suffix |
自定义后置区域 |