Skip to content

Tabbar 标签栏

演示

Tabbar 跨端示例与演示

首页首页

概览、推荐内容和最近动态。

基础用法

vue
<script setup lang="ts">
import { VTabbar, VTabbarItem } from '@varo-ui/h5'
import { shallowRef } from 'vue'

const active = shallowRef('home')
</script>

<template>
  <VTabbar v-model="active" aria-label="主要导航">
    <VTabbarItem name="home">
      <template #icon>
        <img src="/icons/home.svg" alt="">
      </template>
      首页
    </VTabbarItem>
    <VTabbarItem name="messages" badge="2">
      <template #icon>
        <img src="/icons/message.svg" alt="">
      </template>
      消息
    </VTabbarItem>
    <VTabbarItem name="profile" dot>
      <template #icon>
        <img src="/icons/profile.svg" alt="">
      </template>
      我的
    </VTabbarItem>
  </VTabbar>
</template>

VTabbar Props

Prop类型默认值描述
modelValuestring | numberundefined当前选中项
fixedbooleanfalse是否固定在底部
borderbooleantrue是否显示边框
safeAreaInsetBottombooleanfalse是否启用底部安全区

VTabbar Events

EventPayload描述
update:modelValuestring | number选中项变化
changestring | number选中项变化

VTabbarItem Props

Prop类型默认值描述
namestring | number-标签项标识
iconstringundefined图标文本或图标名
badgestring | numberundefined徽标
dotbooleanfalse是否显示小红点

VTabbarItem Slots

Slot描述
default标签文本
icon自定义图标,作为装饰内容隐藏于无障碍树