Tabs 标签页
用于在同一页面内切换不同内容区域(偏 Windows 风格的左侧导航 Tabs)。
Tabs 标签页
用于在同一页面内切换不同内容区域(偏 Windows 风格的左侧导航 Tabs)。
基础用法
Tabs
示例即将加载...
Indicator Showcase
Indicator variants & motions
示例即将加载...
动态内容尺寸(manual, rich content)
Dynamic Content (manual)
示例即将加载...
布局方向(placement)
Placement + Header Slot
示例即将加载...
高度跟随内容(animation.size)
Auto Size (contentScrollable=false)
示例即将加载...
关闭动画(indicator/content)
Disable Animations
示例即将加载...
API
TxTabs Props
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
modelValue | string | - | 当前激活 tab(v-model) |
defaultValue | string | - | 默认激活 tab(当未传 modelValue 时) |
placement | 'left' | 'right' | 'top' | 'bottom' | 'left' | Tabs 布局位置 |
offset | number | 0 | 指示条定位偏移 |
navMinWidth | number | 220 | 左侧导航最小宽度 |
navMaxWidth | number | 320 | 左侧导航最大宽度 |
contentPadding | number | 12 | 内容区 padding |
contentScrollable | boolean | true | 内容是否可滚动(关闭后可用于 autoHeight/autoWidth 的尺寸测量) |
autoHeight | boolean | false | 自动高度(需要 contentScrollable=false + animation.size.enabled=true) |
autoWidth | boolean | false | 自动宽度(需要 animation.size.enabled=true) |
indicatorVariant | 'line' | 'pill' | 'block' | 'dot' | 'outline' | 'line' | 指示器样式 |
indicatorMotion | 'stretch' | 'warp' | 'glide' | 'snap' | 'spring' | 'stretch' | 指示器动效风格 |
indicatorMotionStrength | number | 1 | 指示器动效强度(数值越大越“Q弹”,0 基本关闭 scale 弹性) |
animation | TabsAnimation | - | 动画配置(size/nav/indicator/content) |
animation.size | boolean | { enabled?; durationMs?; easing? } | - | 内容区尺寸动画(高度跟随内容,仅在 contentScrollable=false 时生效)。未传时使用 autoHeight/autoWidth 启用状态与 autoHeightDurationMs/autoHeightEasing 默认值 |
animation.nav | boolean | { enabled?; durationMs?; easing? } | - | 导航容器动画(nav 宽度/布局变化过渡) |
animation.indicator | boolean | { enabled?; durationMs?; easing? } | - | 指示条动画 |
animation.content | boolean | { enabled? } | - | 内容切换过渡(zoom 动画) |
autoHeightDurationMs | number | 250 | animation.size.durationMs 未指定时的默认时长 |
autoHeightEasing | string | ease | animation.size.easing 未指定时的默认缓动 |
Slots
| 名称 | 参数 | 说明 |
|---|---|---|
default | - | 放置 TxTabItem / TxTabItemGroup / TxTabHeader |
nav-right | - | 顶部/底部 Tabs 的导航右侧区域(适合放按钮、搜索等),宽度变化会配合 autoWidth 跟随内容 |
Expose
| 名称 | 类型 | 说明 |
|---|---|---|
refresh | () => void | 触发内容尺寸重新测量(AutoSizer passthrough) |
flip | (action: () => void | Promise<void>) => Promise<void> | 包裹一次变更并使用 FLIP 尺寸过渡 |
action | (fn: (el: HTMLElement) => void | Promise<void>, optionsOrDetect?: any) => Promise<any> | AutoSizer 的 action wrapper(用于丝滑自动切换) |
size | () => { width: number; height: number } | undefined | 当前测量的尺寸信息 |
TxTabItem Props
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
name | string | - | tab 名称(唯一 key) |
iconClass | string | '' | 图标 class |
disabled | boolean | false | 禁用 |
activation | boolean | false | 是否作为初始激活项 |
Events
| 事件名 | 参数 | 说明 |
|---|---|---|
change | string | 切换时触发 |
update:modelValue | string | v-model 更新 |