### TnCountTo: Animated Number Counter
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Animates a number from a start value to an end value. Supports decimal places, thousands separators, and custom durations. Use for displaying dynamic numerical data.
```vue
```
--------------------------------
### TnButton - Button Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
TnButton is a versatile button component supporting various types, shapes, sizes, and features like debouncing, loading states, and WeChat open capabilities. Colors starting with 'tn' utilize TuniaoUI's built-in color system.
```APIDOC
## TnButton - Button Component
### Description
Supports various types, shapes, and sizes of buttons, with built-in features like debouncing, loading states, and WeChat open capabilities. Color properties starting with `tn` use the Tuniao built-in color system.
### Usage Examples
**Basic Usage**
```vue
Primary Button
```
**Plain/Text Buttons**
```vue
Plain ButtonText Button
```
**With Icon, Shadow, Bold Border**
```vue
Delete
```
**Loading State + Debounce**
```vue
Submit
```
**Custom Size and Color**
```vue
Custom
```
**WeChat Mini Program Get Phone Number**
```vue
Get Phone Number
```
**Form Submit Button**
```vue
Submit Form
```
### Props
- **type** (string) - Button type (e.g., 'primary', 'success', 'danger')
- **plain** (boolean) - Whether the button is plain
- **text** (boolean) - Whether the button is a text button
- **icon** (string) - Icon name to display on the button
- **shadow** (boolean) - Whether to apply a shadow
- **shadow-color** (string) - Color of the shadow
- **border-bold** (boolean) - Whether the border is bold
- **loading** (boolean) - Whether the button is in a loading state
- **debounce** (boolean | number) - Enables debouncing for click events
- **width** (string | number) - Custom width of the button
- **height** (string | number) - Custom height of the button
- **bg-color** (string) - Custom background color
- **text-color** (string) - Custom text color
- **open-type** (string) - WeChat open type (e.g., 'getPhoneNumber')
- **form-type** (string) - Form type ('submit', 'reset')
### Events
- **@click** - Emitted when the button is clicked.
- **@getphonenumber** - Emitted when the WeChat `getPhoneNumber` event is triggered.
```
--------------------------------
### useUniAppSystemRectInfo — 系统信息 Hook
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
获取设备导航栏高度、状态栏高度、胶囊按钮位置及屏幕尺寸等系统信息,并自动适配小程序、APP 和 H5 的差异。用于需要根据设备信息进行布局调整的场景。
```typescript
import { useUniAppSystemRectInfo } from '@tuniao/tnui-vue3-uniapp'
// 在 setup 中使用
const { navBarInfo, navBarBoundingInfo, systemScreenInfo, getSystemRectInfo } =
useUniAppSystemRectInfo()
// navBarInfo.height - 导航栏总高度(包含状态栏)
// navBarInfo.statusHeight - 状态栏高度
// navBarBoundingInfo.width - 右上角胶囊宽度
// navBarBoundingInfo.left - 胶囊左边距(可据此计算标题区域宽度)
// systemScreenInfo.width - 屏幕宽度
// systemScreenInfo.operationHeight - 可用内容区域高度
console.log('导航栏高度:', navBarInfo.height)
console.log('状态栏高度:', navBarInfo.statusHeight)
console.log('可用内容高度:', systemScreenInfo.operationHeight)
// 刷新系统信息
getSystemRectInfo()
```
--------------------------------
### useUniAppSystemRectInfo
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Retrieves system information such as navigation bar height, status bar height, capsule button position, and screen dimensions, automatically adapting to differences between Mini Program, APP, and H5 environments.
```APIDOC
## useUniAppSystemRectInfo — System Information Hook
### Description
Fetches essential system UI metrics like navigation bar height, status bar height, and screen dimensions, ensuring cross-platform compatibility.
### Usage
```typescript
import { useUniAppSystemRectInfo } from '@tuniao/tnui-vue3-uniapp'
// In setup function
const { navBarInfo, navBarBoundingInfo, systemScreenInfo, getSystemRectInfo } = useUniAppSystemRectInfo()
// navBarInfo.height - Total navigation bar height (including status bar)
// navBarInfo.statusHeight - Status bar height
// navBarBoundingInfo.width - Width of the top-right capsule button
// navBarBoundingInfo.left - Left margin of the capsule button (can be used to calculate title area width)
// systemScreenInfo.width - Screen width
// systemScreenInfo.operationHeight - Usable content area height
console.log('Navigation bar height:', navBarInfo.height)
console.log('Status bar height:', navBarInfo.statusHeight)
console.log('Usable content height:', systemScreenInfo.operationHeight)
// Refresh system information
getSystemRectInfo()
```
```
--------------------------------
### TnButton - Basic Usage and Variants
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Demonstrates various TnButton types including primary, success (plain), warning (text), danger with icon and shadow, loading state, custom dimensions, and WeChat Mini Program open capabilities.
```vue
主要按钮朴素按钮文本按钮
删除
提交
自定义
获取手机号
提交表单
```
--------------------------------
### TnModal: Command-Line Modal Dialog
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
TnModal allows for command-line invocation of modal dialogs using the `TnModalInstance` ref. It supports asynchronous callback interception for closing the modal. The `show` method accepts configuration options for title, content, button texts, styles, and callback functions for confirm and cancel actions.
```vue
打开对话框
```
--------------------------------
### useNamespace — BEM 类名生成工具
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
用于生成符合 BEM 规范的类名,支持块、元素、修饰符以及 CSS 变量的生成。适用于内部组件开发。
```typescript
import { useNamespace } from '@tuniao/tnui-vue3-uniapp'
const ns = useNamespace('button')
// Block: 'tn-button'
console.log(ns.b())
// Block + suffix: 'tn-button-group'
console.log(ns.b('group'))
// Element: 'tn-button__icon'
console.log(ns.e('icon'))
// Modifier: 'tn-button--disabled'
console.log(ns.m('disabled'))
// Element + Modifier: 'tn-button__icon--active'
console.log(ns.em('icon', 'active'))
// 状态类: 'is-loading'
console.log(ns.is('loading', true)) // 'is-loading'
console.log(ns.is('loading', false)) // ''
// CSS 变量对象
const cssVars = ns.cssVarBlock({ 'bg-color': '#fff', 'text-color': '#333' })
// { '--tn-button-bg-color': '#fff', '--tn-button-text-color': '#333' }
// CSS 变量名
console.log(ns.cssVarBlockName('bg-color')) // '--tn-button-bg-color'
```
--------------------------------
### useToggle — 布尔值切换 Hook
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
提供一个简单的布尔状态切换工具,返回一个响应式状态和一个用于切换该状态的函数。适用于需要简单开关功能的场景。
```typescript
import { useToggle } from '@tuniao/tnui-vue3-uniapp'
// 在 setup 中使用
const [isVisible, toggleVisible] = useToggle(false)
const [isExpanded, toggleExpanded] = useToggle(true)
// 切换状态
toggleVisible() // false -> true
toggleVisible() // true -> false
// 在模板中绑定
// 内容
// 切换显示
```
--------------------------------
### TnForm - Form Validation with TnInput
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Demonstrates TnForm and TnFormItem for form validation using async-validator. Includes username, phone, and remark fields with validation rules and methods for submission and reset.
```vue
提交重置
```
--------------------------------
### TnInput - Various Input Field Types
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Showcases different TnInput configurations including text, password, digit, textarea with auto-height and word limit, underline style with search icon, and a select mode.
```vue
```
--------------------------------
### useNamespace
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
A BEM class name generation tool used internally for component development. It generates class names conforming to the `tn-block__element--modifier` specification and can also generate CSS variable names.
```APIDOC
## useNamespace — BEM Class Name Generation Tool
### Description
Generates BEM-compliant class names (`tn-block__element--modifier`) and CSS variable names for internal component development.
### Usage
```typescript
import { useNamespace } from '@tuniao/tnui-vue3-uniapp'
const ns = useNamespace('button')
// Block: 'tn-button'
console.log(ns.b())
// Block + suffix: 'tn-button-group'
console.log(ns.b('group'))
// Element: 'tn-button__icon'
console.log(ns.e('icon'))
// Modifier: 'tn-button--disabled'
console.log(ns.m('disabled'))
// Element + Modifier: 'tn-button__icon--active'
console.log(ns.em('icon', 'active'))
// State class: 'is-loading'
console.log(ns.is('loading', true)) // 'is-loading'
console.log(ns.is('loading', false)) // ''
// CSS variable object
const cssVars = ns.cssVarBlock({ 'bg-color': '#fff', 'text-color': '#333' })
// { '--tn-button-bg-color': '#fff', '--tn-button-text-color': '#333' }
// CSS variable name
console.log(ns.cssVarBlockName('bg-color')) // '--tn-button-bg-color'
```
```
--------------------------------
### useLongPress — 长按事件 Hook
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
为元素提供长按持续触发能力,常用于数字步进器等需要持续操作的场景。需要配合 touch 事件在模板中使用。
```typescript
import { ref } from 'vue'
import { useLongPress } from '@tuniao/tnui-vue3-uniapp'
// 在 setup 中使用
const count = ref(0)
const longPressEnabled = ref(true)
// 回调函数 + 是否启用长按 + 触发间隔(ms)
const { handleLongPressEvent, clearLongPressTimer } = useLongPress(
() => { count.value++ },
longPressEnabled,
200 // 每200ms触发一次
)
// 模板用法:
//
```
--------------------------------
### useToggle
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
A simple hook for toggling boolean states. It returns a reactive state variable and a function to toggle its value.
```APIDOC
## useToggle — Boolean Toggle Hook
### Description
Provides a simple way to manage and toggle boolean states within your Vue components.
### Usage
```typescript
import { useToggle } from '@tuniao/tnui-vue3-uniapp'
// In setup function
const [isVisible, toggleVisible] = useToggle(false)
const [isExpanded, toggleExpanded] = useToggle(true)
// Toggle state
toggleVisible() // false -> true
toggleVisible() // true -> false
// Bind in template
// Content
// Toggle Visibility
```
```
--------------------------------
### TnImageUpload: Image Upload Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Handles multi-image uploads with progress display, custom logic, and lifecycle hooks. Configure upload URL, limits, size, headers, and callbacks.
```vue
```
--------------------------------
### TnForm / TnFormItem - Form Components
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
TnForm and TnFormItem provide form validation capabilities powered by `async-validator`. They support various trigger methods and allow control over the validation process via instance methods.
```APIDOC
## TnForm / TnFormItem - Form Components
### Description
Form validation components based on `async-validator`. Supports multiple trigger methods and allows control over the validation process via instance methods (`validate`, `resetFields`, `clearValidate`).
### Usage Example
```vue
SubmitReset
```
### TnForm Props
- **ref** (TnFormInstance) - Reference to the form instance.
- **model** (object) - Data model for the form.
- **rules** (object) - Validation rules for the form fields.
- **label-position** (string) - Position of labels ('left', 'right', 'top').
- **label-width** (string | number) - Width of the labels.
### TnFormItem Props
- **label** (string) - Label text for the form item.
- **prop** (string) - The field name in the `model` to validate.
### TnForm Instance Methods
- **validate()**: Validates all fields or a specific field. Returns a Promise resolving to `true` if valid, or rejecting with validation errors.
- **resetFields()**: Resets all form fields to their initial values.
- **clearValidate()**: Clears all validation status and error messages.
### Events
- **@validate** - Emitted when a field's validation status changes. Provides `prop`, `isValid`, and `message`.
```
--------------------------------
### TnPicker - Picker Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
A picker component that slides up from the bottom. It supports single-column, multi-column, and cascade data modes, and allows customization of label, value, and children field names.
```APIDOC
## TnPicker - Picker Component
### Description
Bottom-sliding wheel selector. Supports single-column, multi-column, and cascade data modes. Allows customization of label/value/children field names.
### Props
- `v-model` (any): Bound value.
- `open` (boolean): Controls the visibility of the picker.
- `data` (Array): The data source for the picker.
- `label-key` (string): The key for the display label in data items.
- `value-key` (string): The key for the value in data items.
- `children-key` (string): The key for nested data in cascade mode.
### Events
- `@confirm` (val: any, item: any): Emitted when the confirm button is pressed.
- `@cancel`: Emitted when the cancel button is pressed.
- `@change` (val: any[], index: number, item: any): Emitted when a column's value changes (for multi-column/cascade).
### Usage Example (Single Column)
```vue
(showSinglePicker = false)"
/>
```
### Usage Example (Cascade)
```vue
```
```
--------------------------------
### useLongPress
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Provides long press continuous triggering capability for elements, commonly used in scenarios requiring continuous operation like digital steppers.
```APIDOC
## useLongPress — Long Press Event Hook
### Description
Enables elements to trigger an action repeatedly while being long-pressed, useful for interactive controls.
### Usage
```typescript
import { ref } from 'vue'
import { useLongPress } from '@tuniao/tnui-vue3-uniapp'
// In setup function
const count = ref(0)
const longPressEnabled = ref(true)
// Callback function + enable flag + trigger interval (ms)
const { handleLongPressEvent, clearLongPressTimer } = useLongPress(
() => { count.value++ },
longPressEnabled,
200 // Trigger every 200ms
)
// Template usage:
//
```
```
--------------------------------
### TnSwiper for Image Carousels
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Configures a responsive image carousel with autoplay, loop, custom indicators, and margin effects. Supports custom item content via slots.
```vue
```
--------------------------------
### TnInput - Input Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
TnInput is a multi-functional input component supporting text, number, password, textarea, and custom select modes. It includes features like a clear button, character count, underline border, and form validation integration.
```APIDOC
## TnInput - Input Component
### Description
Multi-functional input field supporting text, number, password, textarea, and custom select modes. It includes a clear button, character count, underline border, and form validation linkage.
### Usage Examples
**Normal Text Input**
```vue
```
**Password Input (Toggle Visibility)**
```vue
```
**Number Input, Max Length Limit**
```vue
```
**Textarea Mode (Auto Height + Character Count)**
```vue
```
**Underline Style + Right Icon**
```vue
```
**Select Mode (Click to Trigger Custom Selector)**
```vue
```
### Props
- **v-model** (string) - Binding value
- **type** (string) - Input type ('text', 'password', 'number', 'digit', 'textarea', 'select')
- **placeholder** (string) - Placeholder text
- **clearable** (boolean) - Whether to show a clear button
- **maxlength** (number) - Maximum input length
- **show-word-limit** (boolean) - Whether to show word limit
- **word-limit-color** (string) - Color of the word limit text
- **auto-height** (boolean) - Whether the textarea has auto height
- **underline** (boolean) - Whether to use underline style
- **right-icon** (string) - Icon name to display on the right
- **confirm-type** (string) - Type of keyboard confirmation button
### Events
- **@confirm** - Emitted when the confirm button is pressed.
- **@click** - Emitted when the input is clicked (especially for 'select' type).
```
--------------------------------
### TnPopup: Versatile Popup Layer Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
TnPopup is a versatile popup component that can appear from the top, bottom, left, right, or center. It supports a mask layer, close button, rounded corners, and bottom safe area. Use the `v-model` to control visibility and event handlers like `open`, `close`, and `overlay-click` for interaction.
```vue
打开弹框底部弹出内容区域居中弹框内容关闭
```
--------------------------------
### TnCountDown: Countdown Timer
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
A countdown timer component supporting day, hour, minute, and second display. Allows switching between Chinese and English separators and offers instance methods for control.
```vue
开始暂停重置
```
--------------------------------
### TnSwiper - Swiper Component
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
A full-featured swiper component that supports automatic playback, looping, indicators (line, dot, number), and adjacent item display with margins.
```APIDOC
## TnSwiper - Swiper Component
### Description
Full-featured swiper component. Supports automatic playback, looping, indicators (line/dot/number), and displaying adjacent items with previous/next margins.
### Props
- `v-model` (number): Current swiper index.
- `data` (Array): Array of banner data.
- `width` (string): Width of the swiper.
- `height` (string): Height of the swiper.
- `autoplay` (boolean): Enable automatic playback.
- `interval` (number): Automatic playback interval in milliseconds.
- `loop` (boolean): Enable infinite loop.
- `indicator` (boolean): Show pagination indicators.
- `indicator-type` (string): Type of indicator ('line', 'dot', 'number').
- `indicator-position` (string): Position of the indicator ('center-bottom', etc.).
- `indicator-active-bg-color` (string): Background color of the active indicator.
- `previous-margin` (string): Margin on the previous side to show adjacent item.
- `next-margin` (string): Margin on the next side to show adjacent item.
### Events
- `@change` (index: number): Emitted when the current swiper index changes.
- `@item-click` (index: number): Emitted when a swiper item is clicked.
### Usage Example
```vue
```
```
--------------------------------
### TnNotify - Message Notification (Imperative Call)
Source: https://context7.com/chinabugotech/tuniaoui-rc-vue3-uniapp/llms.txt
Displays temporary notifications at the top, center, or bottom of the screen. These notifications automatically close after a specified duration. The `show` method of `TnNotifyInstance` is used to trigger these notifications.
```APIDOC
## TnNotify - Message Notification (Imperative Call)
### Description
Page top/bottom/center display of light prompt notifications, triggered by the `show` method of `TnNotifyInstance`, with automatic timed closure.
### Method Signature
`TnNotifyInstance.show(options: {
msg: string,
type?: 'primary' | 'success' | 'warning' | 'danger' | 'error',
position?: 'top' | 'center' | 'bottom',
duration?: number,
bgColor?: string
}): void`
### Usage Example
```vue
Show Notification
```
```