Yt-UI
首页
快速开始
组件文档
首页
快速开始
组件文档
  • 表单组件

    • 输入框 Input
    • 多行输入框 Textarea
    • 开关 Switch
    • 多选框组 CheckboxGroup
    • 单选框组 RadioGroup
    • 滑块 Slider
    • 选择器 Picker
    • 日历 Calendar
    • 表单 Form
  • 展示组件

    • 头像 Avatar
    • 徽标 Badge
    • 卡片 Card
    • 标签 Tag
    • 步骤条 Steps
    • 结果页 Result
    • 空状态 Empty
    • 虚拟列表 VirtualList
  • 交互组件

    • 按钮 Button
    • 悬浮按钮 FAB
    • 图标 Icon
    • 搜索 Search
    • 分段器 Segment
    • 轮播 Swiper
    • 指示点 Dots
  • 反馈组件

    • 加载 Loading
    • 弹窗 Popup
    • 遮罩层 Overlay
    • 通告栏 NoticeBar
  • 导航组件

    • 标签栏 Tabbar
    • 顶部标签栏 TopTabbar
    • 折叠面板 Collapse
    • 课程表 Schedule
  • 布局组件

    • 分割线 Divider
    • 链接 Line
    • 可移动视图 MovableView

yt-tabbar 标签栏组件

属性

属性名类型默认值说明
themeThemeColor'classic'主题颜色
modelValuenumber0当前激活索引 (v-model)
centerIconstring''中间按钮图标
centerBgColorstring'#ffffff20'中间按钮背景色
centerBgColorLaststring'#000'中间按钮最后一个背景色
showTextbooleanfalse是否显示文字
listTabItem[][]标签列表
zIndexnumber | string500层级

TabItem 类型

interface TabItem {
  text?: string // 标签文本
  icon: string // 图标名称或图片地址
  activeIcon?: string // 激活图标
}

主题颜色

<yt-tabbar theme="forest" :list="tabList" />

<yt-tabbar theme="ocean" :list="tabList" />

<yt-tabbar theme="magic" :list="tabList" />

<yt-tabbar theme="blossom" :list="tabList" />

<yt-tabbar theme="sunshine" :list="tabList" />

<yt-tabbar theme="classic" :list="tabList" />

<yt-tabbar theme="forest-sky" :list="tabList" />

<yt-tabbar theme="ocean-sky" :list="tabList" />

<yt-tabbar theme="magic-sky" :list="tabList" />

<yt-tabbar theme="blossom-sky" :list="tabList" />

<yt-tabbar theme="sunshine-sky" :list="tabList" />

事件

事件名参数说明
update:modelValueactiveIndex: numberv-model 更新
change(e: Event, activeIndex: number)标签切换
centerClicke: Event中间按钮点击

示例

基本标签栏

<yt-tabbar :list="[{ icon: 'Home' }, { icon: 'Course' }, { icon: 'Community' }, { icon: 'Me' }]" />

带文字标签栏

<yt-tabbar
  :showText="true"
  :list="[
    { text: '首页', icon: 'Home' },
    { text: '课程', icon: 'Course' },
    { text: '社区', icon: 'Community' },
    { text: '我的', icon: 'Me' }
  ]"
/>

激活图标

<yt-tabbar
  :list="[
    { icon: 'Home', activeIcon: 'HomeActive' },
    { icon: 'Course', activeIcon: 'CourseActive' },
    { icon: 'Community', activeIcon: 'CommunityActive' },
    { icon: 'Me', activeIcon: 'MeActive' }
  ]"
/>

绑定值

<yt-tabbar v-model="currentTab" :list="tabList" />

<yt-tabbar :modelValue="activeIndex" @update:modelValue="activeIndex = $event" :list="tabList" />

中间按钮

<yt-tabbar
  centerIcon="Plus"
  :list="[{ icon: 'Home' }, { icon: 'Search' }, { icon: 'Bell' }, { icon: 'User' }]"
/>

图片图标

<yt-tabbar
  :list="[
    { text: '首页', icon: '/icons/home.png', activeIcon: '/icons/home-active.png' },
    { text: '消息', icon: '/icons/message.png', activeIcon: '/icons/message-active.png' },
    { text: '发现', icon: '/icons/explore.png', activeIcon: '/icons/explore-active.png' },
    { text: '我的', icon: '/icons/profile.png', activeIcon: '/icons/profile-active.png' }
  ]"
/>

事件处理

<yt-tabbar
  v-model="currentTab"
  :list="tabList"
  @change="handleTabChange"
  @centerClick="handleCenterClick"
/>

完整示例

<yt-tabbar
  theme="forest-sky"
  v-model="currentTab"
  centerIcon="Plus"
  :centerBgColor="'#4CAF50'"
  :centerBgColorLast="'#2E7D32'"
  :showText="true"
  :zIndex="1000"
  :list="[
    { text: '首页', icon: 'Home', activeIcon: 'HomeActive' },
    { text: '发现', icon: 'Explore', activeIcon: 'ExploreActive' },
    { text: '消息', icon: 'Message', activeIcon: 'MessageActive' },
    { text: '我的', icon: 'User', activeIcon: 'UserActive' }
  ]"
  @change="handleTabChange"
  @centerClick="handleCenterButton"
/>
最近更新:: 2026/3/9 19:16
Contributors: CHEEMS, 2126340634
Next
顶部标签栏 TopTabbar