更新记录
1.0.0(2026-11-25)
下载此版本
初始版本,参考图鸟vue3的ts版本制作
平台兼容性
uni-app x(5.0)
| Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
支付宝小程序 |
| √ |
√ |
√ |
- |
- |
√ |
- |
其他
| 多语言 |
暗黑模式 |
宽屏模式 |
蒸汽模式 |
| × |
× |
× |
√ |
TN UI X 组件库
基于 uni-app x(Vapor 模式、TypeScript)的 UI 组件库,共 60 个组件,覆盖基础、表单、数据展示、内容展示、反馈、布局、导航等场景。所有组件已在 App(Android)、H5、微信小程序 三端完成编译与运行验证。设计语言参考图鸟 UI(TuniaoUI)。
特性
- 60 个组件:easycom 自动注册,无需手动 import
- Vapor 模式 + TypeScript:props 全类型声明,编译期可查错
- 表单校验体系:
tn-form / tn-form-item 统一管理,tn-input、tn-number-box、tn-switch、tn-slider、tn-rate、tn-checkbox-group、tn-radio-group、tn-image-upload、tn-picker、tn-date-time-picker、tn-calendar 已接入
- 三端验证:App(MuMu 模拟器)、H5(无头 Edge + CDP 自动化交互回归)、微信小程序(编译 + 冒烟回归)
- 内置主题:语义色板(
tn-primary、tn-success、tn-warning、tn-danger、tn-error、tn-info、tn-gray 等)、内置图标集
安装
方式一:插件市场导入(推荐)
HBuilderX → 工具 → 插件市场 → 搜索 ky-tn-ui-x → 导入到项目(自动放入 uni_modules)。
方式二:手动安装
将 uni_modules/ky-tn-ui-x 整个目录复制到你的 uni-app x 项目 uni_modules 下即可。
快速开始
<template>
<view class="page">
<tn-button type="primary" @click="onTap">主要按钮</tn-button>
<tn-input v-model="nickname" placeholder="请输入昵称" prefix-icon="my" clearable />
</view>
</template>
<script setup lang="ts">
const nickname = ref<string>('')
const onTap = () => {
uni.showToast({ title: '点击了按钮' })
}
</script>
使用说明:
- 组件位于
uni_modules/ky-tn-ui-x/components,easycom 自动注册,无需手动 import。
- 尺寸属性传数字按 px 处理,也可传带单位字符串(如
24px)。
- 颜色属性支持内置色板名(如
tn-primary、tn-success、tn-gray-light)、#hex 与 rgba()。
tn-icon 的 name 取图标名(如 home、search),完整图标清单见 common/icon.ts。
- 通用属性
customStyle、customClass 用于覆盖组件内联样式与类名。
组件总览
基础组件:tn-icon、tn-button、tn-tag、tn-badge、tn-loading、tn-avatar、tn-avatar-group、tn-title、tn-divider、tn-footer、tn-empty
表单组件:tn-form、tn-form-item、tn-input、tn-number-box、tn-radio-group、tn-checkbox-group、tn-switch、tn-slider、tn-picker、tn-date-time-picker、tn-region-picker、tn-image-upload、tn-rate、tn-calendar、tn-week-calendar、tn-keyboard
数据展示:tn-line-progress、tn-circle-progress、tn-count-down、tn-count-to、tn-count-scroll
内容展示:tn-read-more、tn-photo-album、tn-swiper、tn-waterfall
反馈组件:tn-popup、tn-modal、tn-notify、tn-notice-bar、tn-action-sheet、tn-loadmore、tn-bubble-box
布局组件:tn-sticky、tn-list、tn-list-item、tn-collapse、tn-scroll-list、tn-subsection、tn-search-box、tn-switch-tab
导航组件:tn-navbar、tn-tabbar、tn-tabs、tn-steps、tn-index-list
其他组件:tn-overlay、tn-lazy-load、tn-swipe-action、tn-swipe-action-item
组件文档
基础组件
Icon 图标
基于字体的图标集,通过 name 指定图标名,支持内置色板、图片图标与自定义尺寸。
Props
| 参数 |
说明 |
类型 |
默认值 |
name |
图标名称或图片地址 |
string |
- |
size |
图标尺寸:sm / lg / xl / 数字 / 带单位字符串 |
string \\| number |
- |
color |
图标颜色:支持 tn-xxx / #xxxxxx / rgba() |
string |
- |
imgMode |
图片模式 |
string |
'aspectFit' |
bold |
是否加粗 |
boolean |
false |
hoverable |
是否有点击态 |
boolean |
false |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-icon name="home" size="24" color="#01beff" />
<tn-icon name="search" size="20" color="tn-success" />
Button 按钮
按钮,支持类型、尺寸、形状、朴素、文本、加载、禁用、块级与阴影。
Props
| 参数 |
说明 |
类型 |
默认值 |
type |
按钮类型:primary / success / warning / danger / error / info / '' |
string |
'primary' |
size |
按钮尺寸:sm / lg / xl |
string |
- |
shape |
按钮形状:'' / round / circle |
string |
- |
width |
- |
string \\| number |
- |
height |
- |
string \\| number |
- |
fontSize |
- |
string \\| number |
- |
bold |
是否加粗 |
boolean |
false |
bgColor |
背景颜色,支持 tn-xxx / #xxxxxx / rgba() |
string |
- |
textColor |
文字颜色 |
string |
- |
borderColor |
边框颜色 |
string |
- |
plain |
是否朴素按钮 |
boolean |
false |
text |
是否文本按钮 |
boolean |
false |
icon |
图标名称 |
string |
- |
iconSize |
图标尺寸 |
string \\| number |
- |
loading |
是否显示加载中 |
boolean |
false |
disabled |
是否禁用 |
boolean |
false |
block |
是否块级按钮 |
boolean |
false |
shadow |
是否显示阴影 |
boolean |
false |
shadowColor |
阴影颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-button type="primary" @click="onTap">主要按钮</tn-button>
<tn-button type="warning" plain icon="star">朴素按钮</tn-button>
<tn-button type="danger" loading>加载中</tn-button>
Tag 标签
标签,用于标记与分类,支持类型、尺寸与朴素样式。
Props
| 参数 |
说明 |
类型 |
默认值 |
text |
标签文字 |
string |
- |
type |
标签类型:primary / success / warning / danger / error / info / '' |
string |
'primary' |
size |
标签尺寸:sm / lg / xl |
string |
- |
shape |
形状:round / circle / circleLeft / circleRight |
string |
'round' |
bgColor |
背景颜色 |
string |
- |
textColor |
文字颜色 |
string |
- |
borderColor |
边框颜色 |
string |
- |
border |
是否显示边框 |
boolean |
false |
borderBold |
是否加粗边框 |
boolean |
false |
bold |
是否加粗文字 |
boolean |
false |
fontSize |
字体大小 |
string \\| number |
- |
width |
- |
string \\| number |
- |
height |
- |
string \\| number |
- |
icon |
图标名称 |
string |
- |
iconSize |
图标尺寸 |
string \\| number |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-tag>
内容
</tn-tag>
Badge 徽标
徽标,展示数字、点或自定义内容,位于内容的右上角。
Props
| 参数 |
说明 |
类型 |
默认值 |
value |
徽标内容 |
string \\| number |
- |
max |
最大值 |
string \\| number |
- |
type |
类型 |
string |
'danger' |
bgColor |
背景颜色 |
string |
- |
textColor |
文字颜色 |
string |
- |
size |
尺寸 |
string \\| number |
- |
fontSize |
字体大小 |
string \\| number |
- |
bold |
是否加粗 |
boolean |
false |
dot |
是否圆点 |
boolean |
false |
absolute |
是否绝对定位 |
boolean |
true |
top |
绝对定位偏移 |
string \\| number |
- |
right |
- |
string \\| number |
- |
absoluteCenter |
绝对定位居中 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-badge />
Loading 加载
加载动画,支持自定义尺寸与颜色。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
true |
mode |
加载动画模式:circle / dot |
string |
'circle' |
color |
颜色 |
string |
- |
size |
尺寸,支持 20px / 20 |
string \\| number |
'18px' |
text |
提示文字 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-loading />
Avatar 头像
头像,支持图片、文字或图标内容,可设置形状与尺寸。
Props
| 参数 |
说明 |
类型 |
默认值 |
url |
头像图片地址 |
string |
- |
icon |
头像图标名称 |
string |
- |
type |
背景色类型 |
string |
'primary' |
size |
尺寸 |
string \\| number |
'38px' |
shape |
形状:circle / square |
string |
'circle' |
imgMode |
图片裁剪模式 |
string |
'aspectFill' |
bgColor |
背景颜色 |
string |
- |
iconColor |
图标颜色 |
string |
- |
iconSize |
图标尺寸 |
string \\| number |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-avatar>
内容
</tn-avatar>
AvatarGroup 头像组
头像组,横向叠放多个头像,超出可显示 +N 计数。
Props
| 参数 |
说明 |
类型 |
默认值 |
urls |
头像图片地址列表 |
string[] |
[] |
max |
最大显示数量 |
number |
4 |
size |
头像尺寸 |
string \\| number |
'34px' |
shape |
形状 |
string |
'circle' |
type |
头像背景类型 |
string |
'primary' |
moreType |
+N 头像背景类型 |
string |
'info' |
gap |
头像间距(负值重叠) |
number |
-8 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-avatar-group />
Title 标题
标题,带左侧竖条装饰与副标题。
Props
| 参数 |
说明 |
类型 |
默认值 |
title |
标题文字 |
string |
- |
subTitle |
辅助文字 |
string |
- |
mode |
模式:normal / vLine / dot / hLine / subTitle |
string |
'vLine' |
size |
尺寸:sm / lg / xl |
string |
- |
align |
对齐方式:left / center / right |
string |
'left' |
color |
主色 |
string |
- |
subColor |
辅助色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-title>
内容
</tn-title>
Divider 分割线
分割线,支持中间文字与虚线。
Props
| 参数 |
说明 |
类型 |
默认值 |
text |
分隔线文字 |
string |
- |
color |
线条颜色 |
string |
- |
textColor |
文字颜色 |
string |
- |
dashed |
是否虚线 |
boolean |
false |
vertical |
是否垂直分隔线 |
boolean |
false |
height |
垂直高度 |
string \\| number |
'16px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-divider />
Footer 页脚
页脚,展示版权与说明信息。
Props
| 参数 |
说明 |
类型 |
默认值 |
text |
底部文字 |
string |
'Copyright © TN UI' |
color |
文字颜色 |
string |
- |
fontSize |
文字大小 |
string \\| number |
'13px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-footer>
内容
</tn-footer>
Empty 空状态
空状态占位,支持自定义文案与图片。
Props
| 参数 |
说明 |
类型 |
默认值 |
icon |
图标名称或图片地址 |
string |
'empty-data' |
text |
提示文字 |
string |
'暂无数据' |
imgMode |
图片模式 |
string |
'aspectFit' |
iconSize |
图标/图片尺寸 |
string \\| number |
'64px' |
iconColor |
图标颜色 |
string |
- |
color |
文字颜色 |
string |
- |
fontSize |
文字大小 |
string \\| number |
'14px' |
marginTop |
上边距 |
string \\| number |
'120px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-empty>
内容
</tn-empty>
表单组件
Form 表单
表单容器,统一管理校验与提交。
Props
| 参数 |
说明 |
类型 |
默认值 |
model |
表单数据对象,配合 tn-form-item 的 prop 校验 |
any |
null |
rules |
校验规则,形如 { key: [{ required: true, message: '必填' }] } |
any |
null |
labelPosition |
标签位置:left / top |
string |
'left' |
labelWidth |
标签宽度 |
string |
'80px' |
disabled |
是否禁用全部表单项 |
boolean |
false |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-form>
内容
</tn-form>
FormItem 表单项
表单项,负责标签、必填星号与错误信息布局。
Props
| 参数 |
说明 |
类型 |
默认值 |
label |
标签文字 |
string |
- |
prop |
校验字段名,支持 model 中的点路径,如 user.name |
string |
- |
rules |
校验规则(局部规则优先于 tn-form 的 rules) |
Array<TnFormRuleItem> \\| null |
null |
error |
外部错误文案,设置后优先展示 |
string |
- |
showError |
是否显示校验错误 |
boolean |
true |
labelWidth |
标签宽度 |
string \\| number |
'80px' |
required |
是否必填 |
boolean |
false |
requiredColor |
必填星号颜色 |
string |
'#ff444f' |
labelColor |
标签颜色 |
string |
- |
bottomBorder |
是否显示底部分割线 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-form-item>
内容
</tn-form-item>
Input 输入框
输入框,支持前后缀图标、密码、清除、字数统计与边框。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
输入值 |
string |
- |
placeholder |
占位文字 |
string |
'请输入内容' |
type |
输入类型:text / number / digit / tel |
string |
'text' |
password |
是否密码框 |
boolean |
false |
showEye |
是否显示密码切换按钮 |
boolean |
true |
clearable |
是否可清除 |
boolean |
false |
disabled |
是否禁用 |
boolean |
false |
readonly |
是否只读 |
boolean |
false |
prefixIcon |
前置图标 |
string |
- |
suffixIcon |
后置图标 |
string |
- |
iconSize |
图标尺寸 |
string \\| number |
'18px' |
size |
尺寸:sm / lg |
string |
- |
bgColor |
背景色 |
string |
'#f4f4f4' |
border |
是否显示边框 |
boolean |
false |
borderColor |
边框颜色 |
string |
- |
fontSize |
字体大小 |
string \\| number |
'14px' |
color |
文字颜色 |
string |
- |
focus |
是否聚焦 |
boolean |
false |
maxlength |
最大长度 |
number |
140 |
confirmType |
键盘确认按钮文字 |
string |
'done' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
input |
focus |
blur |
confirm |
clear |
Slots
示例
<tn-input v-model="nickname" placeholder="请输入昵称" prefix-icon="my" clearable />
<tn-input v-model="password" placeholder="请输入密码" password show-eye suffix-icon="eye" border />
NumberBox 步进器
步进器,增减数值,支持步长、范围与禁用。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
当前值 |
number |
1 |
min |
最小值 |
number |
1 |
max |
最大值 |
number |
99 |
step |
步长 |
number |
1 |
disabled |
是否禁用 |
boolean |
false |
size |
尺寸 |
string \\| number |
'30px' |
inputWidth |
输入框宽度 |
string \\| number |
'44px' |
bgColor |
背景色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
overlimit |
Slots
无
示例
<tn-number-box />
RadioGroup 单选组
单选按钮组,支持纵向或横向排列。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
选项数据 |
TnRadioItem[] |
[] |
modelValue |
选中值 |
string |
- |
disabled |
是否禁用 |
boolean |
false |
activeColor |
激活色 |
string |
'#01beff' |
size |
尺寸 |
string \\| number |
'20px' |
direction |
排列方向:vertical / horizontal |
string |
'vertical' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-radio-group />
CheckboxGroup 复选框组
复选框组,支持纵向或横向排列。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
选项数据 |
TnCheckboxItem[] |
[] |
modelValue |
选中的值 |
string[] |
[] |
disabled |
是否禁用 |
boolean |
false |
activeColor |
选中颜色 |
string |
'#01beff' |
size |
尺寸 |
string \\| number |
'20px' |
direction |
排列方向:vertical / horizontal |
string |
'vertical' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-checkbox-group />
Switch 开关
开关,用于状态切换,支持自定义颜色。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
选中状态 |
boolean |
false |
disabled |
是否禁用 |
boolean |
false |
size |
尺寸:sm / lg |
string |
- |
width |
轨道宽度 |
string \\| number |
- |
activeColor |
激活颜色 |
string |
'#01beff' |
inactiveColor |
未激活颜色 |
string |
'#dedede' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-switch />
Slider 滑动条
滑动条,拖动取值,支持步长与范围。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
当前值 |
number |
0 |
min |
最小值 |
number |
0 |
max |
最大值 |
number |
100 |
step |
步长 |
number |
1 |
disabled |
是否禁用 |
boolean |
false |
activeColor |
激活色 |
string |
'#01beff' |
inactiveColor |
未激活色 |
string |
'#e6e6e6' |
blockSize |
滑块大小 |
number |
20 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
changing |
change |
Slots
无
示例
<tn-slider />
Picker 选择器
选择器,支持单列、多列与级联,基于 picker-view。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
picker 绑定的值 |
string \\| number \\| Array<string \\| number> |
- |
open |
是否显示 picker 弹框 |
boolean |
false |
data |
picker 选项数据 |
Array<any> |
[] |
labelKey |
选项数据 label 属性名 |
string |
'label' |
valueKey |
选项数据 value 属性名 |
string |
'value' |
childrenKey |
选项数据 children 属性名,级联模式生效 |
string |
'children' |
mode |
选择器模式:signle / multiple / cascade |
string |
'signle' |
showCancel |
显示取消按钮 |
boolean |
true |
cancelText |
取消按钮文本 |
string |
'取 消' |
cancelColor |
取消按钮颜色 |
string |
- |
showConfirm |
显示确定按钮 |
boolean |
true |
confirmText |
确定按钮文本 |
string |
'确 定' |
confirmColor |
确定按钮颜色 |
string |
- |
mask |
显示遮罩 |
boolean |
false |
zIndex |
层级 |
number |
1001 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
update:open |
change |
confirm |
cancel |
close |
Slots
无
示例
<tn-picker v-model="city" :open="pickerOpen" :data="cityOptions" mode="signle" @update:open="pickerOpen = $event" />
DateTimePicker 日期时间选择器
日期时间选择器,支持年、年月、日期、日期时间与时间等模式。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
绑定的值,格式 YYYY/MM/DD HH:mm:ss 或 YYYY-MM-DD HH:mm:ss |
string |
- |
open |
是否显示选择器 |
boolean |
false |
mode |
选择器类型:year / yearmonth / date / datetime / time / datetimeNoSecond / timeNoSecond |
string |
'date' |
minTime |
最小可选时间 |
string |
- |
maxTime |
最大可选时间 |
string |
- |
initCurrentDateTime |
空值是否初始化为当前时间 |
boolean |
true |
format |
日期时间格式化 |
string |
- |
showCancel |
显示取消按钮 |
boolean |
true |
cancelText |
取消按钮文本 |
string |
'取 消' |
cancelColor |
取消按钮颜色 |
string |
- |
showConfirm |
显示确定按钮 |
boolean |
true |
confirmText |
确定按钮文本 |
string |
'确 定' |
confirmColor |
确定按钮颜色 |
string |
- |
mask |
显示遮罩 |
boolean |
false |
zIndex |
层级 |
number |
1001 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
update:open |
change |
confirm |
cancel |
close |
Slots
无
示例
<tn-date-time-picker />
RegionPicker 地区选择器
地区选择器,省市区三级联动,内置地区数据。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
绑定的值,省市区 code 或 name 数组 |
string[] |
[] |
open |
是否显示地区选择器 |
boolean |
false |
showCancel |
显示取消按钮 |
boolean |
true |
cancelText |
取消按钮文本 |
string |
'取 消' |
cancelColor |
取消按钮颜色 |
string |
- |
showConfirm |
显示确定按钮 |
boolean |
true |
confirmText |
确定按钮文本 |
string |
'确 定' |
confirmColor |
确定按钮颜色 |
string |
- |
mask |
显示遮罩 |
boolean |
false |
zIndex |
层级 |
number |
1001 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
update:open |
change |
confirm |
cancel |
close |
Slots
无
示例
<tn-region-picker />
ImageUpload 图片上传
图片上传,支持多图选择、预览、删除与上传进度。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
图片地址列表 |
string[] |
[] |
max |
最大数量 |
number |
9 |
disabled |
是否禁用 |
boolean |
false |
deletable |
是否可删除 |
boolean |
true |
uploadText |
上传按钮文字 |
string |
'上传图片' |
uploadIconSize |
上传图标尺寸 |
string \\| number |
'22px' |
size |
单个格子高度 |
string \\| number |
'76px' |
columns |
每行列数 |
number |
4 |
preview |
是否可预览 |
boolean |
true |
action |
上传地址,为空时不上传后端(使用本地临时路径或自定义上传处理) |
string |
- |
name |
上传文件字段名 |
string |
'file' |
header |
上传请求 header |
any |
null |
formData |
上传请求额外 formData |
any |
null |
sizeType |
选择图片的 sizeType |
string[] |
['original' |
sourceType |
选择图片的 sourceType |
string[] |
['album' |
multiple |
是否允许多选 |
boolean |
true |
maxSize |
允许上传的最大图片大小(byte) |
number |
10 * 1024 * 1024 |
extensions |
允许上传的图片后缀 |
string[] |
['jpg', 'jpeg', 'png', 'gif', 'webp' |
showUploadProgress |
是否显示上传进度 |
boolean |
true |
autoRemoveFaildFile |
上传失败后是否自动移除 |
boolean |
false |
validateEvent |
值修改时是否触发表单校验 |
boolean |
true |
beforeUpload |
上传前校验,返回 false 或 resolve(false) 阻止该文件上传 |
((file : string) => boolean \\| Promise<boolean>) \\| null |
null |
beforeRemove |
删除前校验,返回 false 或 resolve(false) 阻止删除 |
((index : number, file : string) => boolean \\| Promise<boolean>) \\| null |
null |
customUploadHandler |
自定义上传处理,返回最终 URL 或 Promise,为空则使用本地临时路径 |
((file : string) => string \\| Promise<string>) \\| null |
null |
customUploadCallback |
内置上传响应处理,返回最终 URL 或 Promise |
((res : any) => string \\| Promise<string>) \\| null |
null |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
add |
remove |
click |
preview |
success |
fail |
oversizeOrNoSupport |
Slots
无
示例
<tn-image-upload />
Rate 评分
评分,星标打分,支持半选与自定义颜色。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
当前评分 |
number |
0 |
count |
星星数量 |
number |
5 |
allowHalf |
是否允许半星 |
boolean |
false |
disabled |
是否禁用 |
boolean |
false |
size |
尺寸 |
string \\| number |
'22px' |
gap |
间距 |
string \\| number |
'4px' |
activeColor |
激活色 |
string |
'#fbbd12' |
inactiveColor |
未激活色 |
string |
'#e6e6e6' |
activeIcon |
激活图标 |
string |
'star-fill' |
inactiveIcon |
未激活图标 |
string |
'star' |
allowReset |
点击已选中项是否重置 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-rate />
Calendar 日历
日历,支持单日选择、多选与区间选择(公历)。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
日期绑定值,格式 YYYY-MM-DD 或 YYYY/MM/DD,range 模式为数组 |
string \\| Array<string> |
- |
activeBgColor |
选中时的背景颜色 |
string |
- |
activeTextColor |
选中时的文字颜色 |
string |
- |
rangeBgColor |
日期范围内的背景颜色 |
string |
- |
rangeTextColor |
日期范围内的文字颜色 |
string |
- |
mode |
日期模式:date / multi / range |
string |
'date' |
minDate |
最小日期 |
string |
- |
maxDate |
最大日期 |
string |
- |
allowChangeYear |
是否允许切换年份 |
boolean |
true |
allowChangeMonth |
是否允许切换月份 |
boolean |
true |
showLunar |
是否显示农历(当前版本不支持) |
boolean |
false |
rangeStartDesc |
range 模式开始时间提示 |
string |
'开始' |
rangeEndDesc |
range 模式结束时间提示 |
string |
'结束' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
change-year |
change-month |
Slots
无
示例
<tn-calendar v-model="date" mode="date" />
WeekCalendar 周日历
周日历,按周切换查看与选中日期。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
绑定月份选中日期的值 |
number |
0 |
activeBgColor |
选中时的背景颜色 |
string |
- |
activeTextColor |
选中时的文字颜色 |
string |
- |
year |
绑定的年份 |
string \\| number |
- |
month |
绑定的月份 |
string \\| number |
- |
minDate |
最小可选日期 |
string \\| number |
- |
maxDate |
最大可选日期 |
string \\| number |
- |
customData |
自定义数据 |
WeekCalendarCustomItem[] |
[] |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
week-change |
Slots
无
示例
<tn-week-calendar />
Keyboard 数字键盘
数字键盘,支持 number、idcard、car 等模式。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
键盘输入绑定的值 |
string |
- |
show |
是否显示键盘 |
boolean |
false |
mode |
键盘类型:number / digit / idcard / random / car |
string |
'number' |
carLang |
车牌键盘中英文模式 |
string |
'cn' |
vibrate |
点击按钮是否有震动效果 |
boolean |
true |
longPressDelete |
是否允许长按连续删除 |
boolean |
true |
disabled |
禁止键盘输入 |
boolean |
false |
overlayCloseable |
点击遮罩关闭键盘 |
boolean |
true |
zIndex |
层级 |
number |
1001 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
update:show |
update:carLangMode |
change |
close |
backspace |
confirm |
Slots
无
示例
<tn-keyboard v-model="value" :show="keyboardShow" mode="number" @update:show="keyboardShow = $event" />
数据展示
LineProgress 线形进度条
线形进度条,按百分比展示进度,支持条纹与动画。
Props
| 参数 |
说明 |
类型 |
默认值 |
percent |
进度百分比 0 - 100 |
number |
0 |
height |
进度条高度 |
string \\| number |
'6px' |
bgColor |
进度条背景色 |
string |
- |
activeColor |
进度条激活色 |
string |
'#01beff' |
showPercent |
是否显示百分比 |
boolean |
true |
striped |
是否开启条纹 |
boolean |
false |
animation |
条纹是否运动 |
boolean |
false |
radius |
圆角 |
string \\| number |
'999px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-line-progress />
CircleProgress 圆环进度条
圆环进度条,按百分比展示进度,支持自定义半径与环宽。
Props
| 参数 |
说明 |
类型 |
默认值 |
percent |
当前进度百分比 0 - 100 |
number |
0 |
activeColor |
激活颜色 |
string |
'#01beff' |
inactiveColor |
未激活颜色 |
string |
'#e6e6e6' |
showPercent |
是否显示百分比 |
boolean |
true |
duration |
动画执行时间,单位 ms |
number |
1500 |
radius |
圆环半径,单位 px |
number |
50 |
ringWidth |
圆环宽度,单位 px |
number |
7 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-circle-progress :percent="65" :radius="56" :ring-width="8" />
CountDown 倒计时
倒计时,支持时分秒格式化与结束事件。
Props
| 参数 |
说明 |
类型 |
默认值 |
seconds |
倒计时总秒数 |
number |
3600 |
autoStart |
是否自动开始 |
boolean |
true |
format |
格式:HH:mm:ss / DD:HH:mm:ss / mm:ss |
string |
'HH:mm:ss' |
color |
文字颜色 |
string |
- |
bgColor |
背景色 |
string |
'rgba(0, 0, 0 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-count-down />
CountTo 数字跳转
数字跳转,数值变化动画,支持千分位与前后缀。
Props
| 参数 |
说明 |
类型 |
默认值 |
startVal |
起始值 |
number |
0 |
endVal |
结束值 |
number |
0 |
duration |
动画时长(毫秒) |
number |
1200 |
decimals |
小数位数 |
number |
0 |
separator |
千分位分隔符 |
string |
- |
autoplay |
是否自动开始 |
boolean |
true |
prefix |
前缀 |
string |
- |
suffix |
后缀 |
string |
- |
fontSize |
字体大小 |
string \\| number |
'16px' |
color |
文字颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-count-to />
CountScroll 数字逐位滚动
数字逐位滚动,支持千分位与小数点。
Props
| 参数 |
说明 |
类型 |
默认值 |
value |
显示的值 |
string \\| number |
- |
fontSize |
字体大小 |
string \\| number |
'16px' |
textColor |
文字颜色 |
string |
- |
decimalSeparator |
小数点分隔符 |
string |
'.' |
thousandsSeparator |
千分位分隔符,为空则不显示千分位 |
string |
' |
duration |
动画时长,单位 ms |
number |
1500 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-count-scroll />
内容展示
ReadMore 阅读更多
阅读更多,长内容折叠与展开,支持自定义展开方式。
Props
| 参数 |
说明 |
类型 |
默认值 |
expand |
是否默认展开 |
boolean |
false |
height |
折叠时高度 |
string \\| number |
'80px' |
expandText |
展开文字 |
string |
'展开' |
foldText |
折叠文字 |
string |
'收起' |
toggleIcon |
切换图标 |
string |
'down' |
tipColor |
提示颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-read-more>
内容
</tn-read-more>
PhotoAlbum 相册
相册,九宫格展示与预览。
Props
| 参数 |
说明 |
类型 |
默认值 |
urls |
图片地址列表 |
string[] |
[] |
columns |
列数 |
number |
3 |
gap |
间距 |
number |
4 |
radius |
圆角 |
string \\| number |
'7.5px' |
height |
高度(正方形比例时按宽度自动) |
string \\| number |
- |
imgMode |
图片模式 |
string |
'aspectFill' |
preview |
是否可点击预览 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-photo-album />
Swiper 轮播图
轮播图,支持自动播放、指示点与自定义高度。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
图片地址列表 |
string[] |
[] |
height |
高度 |
string \\| number |
'160px' |
autoplay |
是否自动播放 |
boolean |
true |
interval |
播放间隔 |
number |
4000 |
duration |
切换时长 |
number |
400 |
circular |
是否循环 |
boolean |
true |
indicator |
是否显示指示点 |
boolean |
true |
indicatorColor |
指示点颜色 |
string |
'rgba(255, 255, 255 |
indicatorActiveColor |
激活指示点颜色 |
string |
- |
imgMode |
图片模式 |
string |
'aspectFill' |
radius |
圆角 |
string \\| number |
'10px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-swiper />
Waterfall 瀑布流
瀑布流,双列不等高布局。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
数据 |
TnWaterfallItem[] |
[] |
gap |
列间距 |
number |
8 |
radius |
卡片圆角 |
string \\| number |
'7.5px' |
titleColor |
标题颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-waterfall />
反馈组件
Popup 弹出层
弹出层,支持上、下、左、右、中五个方向与圆角、关闭按钮。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
false |
position |
弹出位置:bottom / top / left / right / center |
string |
'bottom' |
round |
是否圆角 |
boolean |
true |
bgColor |
背景色 |
string |
'#ffffff' |
opacity |
遮罩透明度 |
number |
0.5 |
closeable |
是否显示关闭按钮 |
boolean |
false |
closeOnClick |
点击遮罩是否关闭 |
boolean |
true |
zIndex |
层级 |
number |
1000 |
safeArea |
是否留出安全区 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-popup :show="popupShow" position="bottom" round :closeable="true" @close="popupShow = false">
<view class="popup-content">弹窗内容</view>
</tn-popup>
Modal 模态框
模态框,组合标题、内容与按钮,居中弹出。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
false |
title |
标题 |
string |
- |
content |
内容 |
string |
- |
confirmText |
确认按钮文字 |
string |
'确定' |
cancelText |
取消按钮文字 |
string |
'取消' |
showCancel |
是否显示取消按钮 |
boolean |
true |
confirmColor |
确认按钮颜色 |
string |
'#01beff' |
cancelColor |
取消按钮文字颜色 |
string |
- |
width |
宽度 |
string \\| number |
- |
round |
圆角 |
boolean |
true |
closeOnClick |
点击遮罩关闭 |
boolean |
true |
opacity |
遮罩透明度 |
number |
0.5 |
zIndex |
层级 |
number |
1000 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
close |
confirm |
cancel |
update:show |
Slots
示例
<tn-modal>
内容
</tn-modal>
Notify 消息通知
消息通知,支持顶部、居中、底部弹出。
Props
| 参数 |
说明 |
类型 |
默认值 |
offsetTop |
距离顶部的距离 |
string \\| number |
12 |
zIndex |
层级 |
number |
1001 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-notify />
NoticeBar 通知栏
通知栏,横向滚动展示通知,支持图标与关闭。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
true |
data |
公告内容,字符串或数组 |
string[] |
[] |
bgColor |
背景色 |
string |
'#fbbd12' |
textColor |
文字颜色 |
string |
- |
fontSize |
字体大小 |
string \\| number |
'13px' |
leftIcon |
左侧图标 |
string |
'sound' |
leftIconColor |
- |
string |
- |
leftIconSize |
- |
string \\| number |
'16px' |
rightIcon |
关闭图标 |
string |
'close' |
rightIconColor |
- |
string |
- |
rightIconSize |
- |
string \\| number |
'14px' |
closable |
是否可关闭 |
boolean |
true |
play |
是否自动轮播 |
boolean |
true |
interval |
轮播间隔(毫秒) |
number |
3000 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-notice-bar />
ActionSheet 操作菜单
操作菜单,从底部弹出可选项列表,支持取消与危险项。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
false |
title |
标题 |
string |
- |
list |
选项数据 |
TnActionSheetItem[] |
[] |
cancelText |
取消按钮文字 |
string |
'取消' |
showCancel |
是否显示取消按钮 |
boolean |
true |
round |
是否圆角 |
boolean |
true |
safeArea |
是否留出安全区 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
select |
cancel |
close |
update:show |
Slots
无
示例
<tn-action-sheet />
Loadmore 加载更多
加载更多,展示加载中、没有更多或加载失败。
Props
| 参数 |
说明 |
类型 |
默认值 |
status |
状态:loadmore / loading / nomore |
string |
'loadmore' |
size |
尺寸 |
string \\| number |
'16px' |
color |
文字颜色 |
string |
- |
text |
自定义文字 |
string |
'点击加载更多' |
loadingColor |
加载中颜色 |
string |
'#01beff' |
loadingText |
加载中文字 |
string |
'正在加载...' |
nomoreIcon |
没有更多图标 |
string |
'empty-data' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
无
示例
<tn-loadmore />
BubbleBox 气泡菜单
气泡菜单,向四个方向弹出操作列表。
Props
| 参数 |
说明 |
类型 |
默认值 |
options |
气泡弹出框选项数据 |
BubbleBoxOptionItem[] |
[] |
position |
气泡位置:top / bottom / left / right |
string |
'top' |
width |
气泡宽度 |
string \\| number |
'120px' |
height |
气泡高度 |
string \\| number |
- |
bgColor |
气泡背景色 |
string |
- |
textColor |
气泡文字颜色 |
string |
- |
optionItemPadding |
选项内边距 |
string |
- |
disabled |
是否禁止点击选项 |
boolean |
false |
autoClose |
点击选项后自动关闭 |
boolean |
true |
zIndex |
层级 |
number |
500 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-bubble-box>
内容
</tn-bubble-box>
布局组件
Sticky 吸顶
吸顶容器,滚动时把内容固定到指定位置。
Props
| 参数 |
说明 |
类型 |
默认值 |
enabled |
是否开启粘性布局 |
boolean |
true |
offsetTop |
粘性布局距离顶部的距离 |
string \\| number |
0 |
zIndex |
层级 |
number |
99 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-sticky>
内容
</tn-sticky>
List 列表
列表容器,包裹 tn-list-item 并统一边框样式。
Props
| 参数 |
说明 |
类型 |
默认值 |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-list>
内容
</tn-list>
ListItem 列表项
列表项,支持标题、描述、右侧文字、箭头与点击事件。
Props
| 参数 |
说明 |
类型 |
默认值 |
title |
标题 |
string |
- |
icon |
左侧图标 |
string |
- |
iconSize |
- |
string \\| number |
'20px' |
iconColor |
- |
string |
- |
rightText |
右侧文字 |
string |
- |
rightIcon |
右侧图标 |
string |
'right' |
rightIconSize |
- |
string \\| number |
'14px' |
rightIconColor |
- |
string |
- |
padding |
内边距 |
string |
'14px' |
fontSize |
字体大小 |
string \\| number |
'14px' |
color |
文字颜色 |
string |
- |
bgColor |
背景色 |
string |
- |
height |
高度 |
string \\| number |
- |
bottomBorder |
是否显示底部边框 |
boolean |
true |
borderIndent |
底部边框缩进 |
string \\| number |
'0px' |
hoverable |
是否有点击态 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-list-item>
内容
</tn-list-item>
Collapse 折叠面板
折叠面板,展开或收起内容区。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
折叠面板数据 |
TnCollapseItemConfig[] |
[] |
modelValue |
当前展开项的名称 |
string[] |
[] |
accordion |
是否手风琴模式 |
boolean |
false |
color |
标题颜色 |
string |
- |
contentColor |
内容颜色 |
string |
- |
iconColor |
图标颜色 |
string |
- |
arrowIcon |
箭头图标 |
string |
'down' |
bottomBorder |
是否显示底部边框 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
示例
<tn-collapse />
ScrollList 横向滚动
横向滚动列表,底部指示器展示滚动位置。
Props
| 参数 |
说明 |
类型 |
默认值 |
indicator |
是否显示指示器 |
boolean |
true |
indicatorWidth |
指示器宽度,单位 px |
number |
40 |
indicatorBlockWidth |
指示器滑块宽度,单位 px |
number |
20 |
indicatorColor |
指示器背景颜色 |
string |
- |
indicatorBlockColor |
指示器滑块背景颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
scroll-left |
scroll-right |
Slots
示例
<tn-scroll-list>
内容
</tn-scroll-list>
Subsection 分段器
分段器,在一组选项间切换,支持滑动与颜色配置。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
选项数据 |
string[] |
[] |
modelValue |
当前选中索引 |
number |
0 |
size |
尺寸:sm / lg |
string |
- |
radius |
圆角 |
string \\| number |
'999px' |
bgColor |
背景色 |
string |
'#f4f4f4' |
activeColor |
激活色 |
string |
'#01beff' |
color |
文字颜色 |
string |
- |
activeTextColor |
激活文字颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-subsection />
SearchBox 搜索框
搜索框,提供输入与搜索事件,支持前后缀与取消按钮。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
输入值 |
string |
- |
placeholder |
占位文字 |
string |
'搜索内容' |
placeholderIcon |
搜索图标 |
string |
'search' |
shape |
形状:round / square |
string |
'round' |
size |
尺寸:sm / lg |
string |
- |
textColor |
文字颜色 |
string |
- |
placeholderColor |
占位文字颜色 |
string |
- |
textAlign |
输入对齐 |
string |
'left' |
bgColor |
背景色 |
string |
'#f4f4f4' |
border |
是否显示边框 |
boolean |
false |
borderColor |
边框颜色 |
string |
- |
focus |
是否聚焦 |
boolean |
false |
disabled |
是否禁用 |
boolean |
false |
clearable |
是否可清除 |
boolean |
true |
searchButton |
是否显示搜索按钮 |
boolean |
false |
searchButtonText |
搜索按钮文字 |
string |
'搜索' |
searchButtonTextColor |
搜索按钮文字颜色 |
string |
- |
searchButtonBgColor |
搜索按钮背景色 |
string |
- |
confirmType |
键盘确认按钮文字 |
string |
'search' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
input |
focus |
blur |
search |
clear |
Slots
无
示例
<tn-search-box />
SwitchTab 选项卡切换
选项卡切换,紧凑的分段标签切换器。
Props
| 参数 |
说明 |
类型 |
默认值 |
modelValue |
当前激活的标签索引 |
number |
0 |
tabs |
标签列表 |
string[] |
[] |
disabled |
是否禁用 |
boolean |
false |
inactiveBgColor |
未选中时的背景颜色 |
string |
- |
activeBgColor |
选中时的背景颜色 |
string |
- |
inactiveTextColor |
未选中时的文字颜色 |
string |
- |
activeTextColor |
选中时的文字颜色 |
string |
- |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
Slots
无
示例
<tn-switch-tab />
导航组件
Navbar 顶部导航栏
自定义导航栏,支持标题、左右图标与固定定位。
Props
| 参数 |
说明 |
类型 |
默认值 |
title |
标题 |
string |
- |
showBack |
是否显示返回按钮 |
boolean |
false |
backIcon |
返回图标 |
string |
'left' |
statusBarHeight |
状态栏高度 |
string \\| number |
'0px' |
height |
导航栏高度 |
string \\| number |
'44px' |
bgColor |
背景色 |
string |
'#ffffff' |
textColor |
文字颜色 |
string |
- |
fixed |
是否固定 |
boolean |
false |
placeholder |
是否生成占位 |
boolean |
true |
bottomShadow |
底部阴影 |
boolean |
false |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-navbar>
内容
</tn-navbar>
Tabbar 底部导航栏
底部导航栏,图标加文字项,支持选中态与徽标。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
数据 |
TnTabbarItemConfig[] |
[] |
modelValue |
当前选中项 |
string |
- |
height |
高度 |
string \\| number |
'50px' |
bgColor |
背景色 |
string |
'#ffffff' |
activeColor |
激活色 |
string |
'#01beff' |
color |
未激活色 |
string |
- |
iconSize |
图标尺寸 |
string \\| number |
'22px' |
fixed |
是否固定底部 |
boolean |
true |
placeholder |
是否生成占位 |
boolean |
true |
safeAreaInsetBottom |
是否留出底部安全区 |
boolean |
true |
navigator |
是否点击跳转 path |
boolean |
false |
topShadow |
勾选动画 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
click |
Slots
无
示例
<tn-tabbar />
Tabs 标签栏
标签栏,横向切换标签,支持徽标与滚动。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
标签数据 |
TnTabConfig[] |
[] |
modelValue |
当前激活项 |
string |
- |
height |
高度 |
string \\| number |
'44px' |
bgColor |
背景色 |
string |
'#ffffff' |
activeColor |
激活色 |
string |
'#01beff' |
color |
默认文字色 |
string |
- |
barWidth |
滑块宽度 |
string \\| number |
'20px' |
barHeight |
滑块高度 |
string \\| number |
'3px' |
fontSize |
字体大小 |
string \\| number |
'14px' |
activeBold |
是否加粗激活项 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
| 事件名 |
update:modelValue |
change |
click |
Slots
无
示例
const tabs = ref<Array<{ name : string, title : string, badge ?: string | number }>>([
{ name: 'tab1', title: '推荐' },
{ name: 'tab2', title: '关注', badge: 3 }
])
<tn-tabs :list="tabs" v-model="activeTab" @change="onTabChange" />
Steps 步骤条
步骤条,展示流程进度,支持已完成、进行中与未开始状态。
Props
| 参数 |
说明 |
类型 |
默认值 |
list |
步骤数据 |
TnStepConfig[] |
[] |
current |
当前步骤索引 |
number |
0 |
activeColor |
已完成/激活颜色 |
string |
'#01beff' |
color |
未激活颜色 |
string |
'#9c9c9c' |
nodeSize |
节点尺寸 |
string \\| number |
'26px' |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
无
示例
<tn-steps />
IndexList 索引列表
索引列表,右侧字母索引快速定位。
Props
| 参数 |
说明 |
类型 |
默认值 |
data |
数据源 |
Record<string, IndexListDataGroup> |
() : Record<string |
height |
索引列表高度,单位 px,不传则以窗口高度为准 |
number |
0 |
stickyOffsetTop |
标题吸顶距离 |
number |
0 |
titleBgColor |
标题背景颜色 |
string |
- |
titleColor |
标题文字颜色 |
string |
- |
titleSize |
标题尺寸:sm / lg / xl 或具体值 |
string |
- |
showKeysList |
是否显示右侧索引列表 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-index-list>
内容
</tn-index-list>
其他组件
Overlay 遮罩层
遮罩层,控制透明度并支持点击关闭与自定义内容。
Props
| 参数 |
说明 |
类型 |
默认值 |
show |
是否显示 |
boolean |
false |
opacity |
透明度 |
number |
0.5 |
bgColor |
背景色 |
string |
- |
zIndex |
层级 |
number |
1000 |
closeOnClick |
点击是否关闭 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-overlay>
内容
</tn-overlay>
LazyLoad 懒加载
图片懒加载,基于平台原生懒加载策略,支持 loading 与 error 插槽。
Props
| 参数 |
说明 |
类型 |
默认值 |
src |
图片地址 |
string |
- |
height |
图片高度 |
string \\| number |
'150px' |
width |
图片宽度 |
string \\| number |
'100%' |
mode |
图片裁剪模式 |
string |
'aspectFill' |
threshold |
进入视口多少距离后开始加载 |
number |
100 |
transition |
是否开启过渡效果 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-lazy-load />
SwipeAction 滑动菜单
滑动操作容器,包裹 tn-swipe-action-item 并管理展开状态。
Props
| 参数 |
说明 |
类型 |
默认值 |
exclusive |
只允许一个 item 处于打开状态(当前版本未实现联动) |
boolean |
true |
autoClose |
自动关闭菜单 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
无
Slots
示例
<tn-swipe-action>
内容
</tn-swipe-action>
SwipeActionItem 滑动项
滑动操作项,左滑或右滑显示操作按钮。
Props
| 参数 |
说明 |
类型 |
默认值 |
options |
菜单配置项 |
SwipeActionItemOptionItem[] |
[] |
disabled |
是否禁用 |
boolean |
false |
threshold |
滑动阈值 |
number |
20 |
autoClose |
自动关闭菜单 |
boolean |
true |
customStyle |
自定义样式 |
string |
- |
customClass |
自定义类名 |
string |
- |
Events
Slots
示例
<tn-swipe-action-item>
内容
</tn-swipe-action-item>
目录结构
ky-tn-ui-x/
├── components/ # 60 个组件(easycom 自动注册)
├── common/ # theme 色板、icon 映射、form 校验工具
└── styles/ # 小程序端图标字体样式
协议与致谢
- 本项目基于 MIT License 开源。
- 设计语言参考 图鸟 UI(TuniaoUI);图标 unicode 与字体来源
@tuniao/tn-icon(ISC License)。
- 组件文档与本文档由
scripts/gen-html-docs.mjs 从组件源码自动生成。