🔥 遇见我们的新项目 t0ggles - 您终极的项目管理工具! 🔥

Tabbar Vue 组件

Tabbar 是 工具栏 的一个特例,但它包含图标(或带标签的图标)而不是普通链接,旨在用于切换选项卡

Tabbar 组件

包含以下组件

  • 选项卡栏
  • TabbarLink

Tabbar 属性

Tabbar 组件扩展了 工具栏 组件,它支持所有 工具栏 属性 以及以下附加属性

名称类型默认值描述
icons布尔值false

启用带图标的选项卡栏

labels布尔值false

启用带标签的选项卡栏

TabbarLink 组件扩展了 链接 组件,它支持所有 链接 属性 以及以下附加属性

名称类型默认值描述
active布尔值false

使此选项卡栏链接处于活动状态

component字符串'a'

组件的 HTML 元素

label字符串

链接标签内容

linkProps任何

包含要传递给链接/按钮的附加属性(属性)的对象

名称描述
icon

链接图标内容

label

链接标签内容

示例

Tabbar.vue
<template>
<k-page>
<k-navbar title="Tabbar" />
<k-tabbar
:labels="isTabbarLabels"
:icons="isTabbarIcons"
class="left-0 bottom-0 fixed"
>
<k-tabbar-link
:active="activeTab === 'tab-1'"
@click="() => (activeTab = 'tab-1')"
>
<template v-if="isTabbarLabels" #label> Tab 1 </template>
<template v-if="isTabbarIcons" #icon>
<k-icon>
<template #ios>
<EnvelopeFill class="w-7 h-7" />
</template>
<template #material>
<MdEmail class="w-6 h-6" />
</template>
</k-icon>
</template>
</k-tabbar-link>
<k-tabbar-link
:active="activeTab === 'tab-2'"
@click="() => (activeTab = 'tab-2')"
>
<template v-if="isTabbarLabels" #label> Tab 2 </template>
<template v-if="isTabbarIcons" #icon>
<k-icon>
<template #ios>
<Calendar class="w-7 h-7" />
</template>
<template #material>
<MdToday class="w-6 h-6" />
</template>
</k-icon>
</template>
</k-tabbar-link>
<k-tabbar-link
:active="activeTab === 'tab-3'"
@click="() => (activeTab = 'tab-3')"
>
<template v-if="isTabbarLabels" #label> Tab 3 </template>
<template v-if="isTabbarIcons" #icon>
<k-icon>
<template #ios>
<CloudUploadFill class="w-7 h-7" />
</template>
<template #material>
<MdFileUpload class="w-6 h-6" />
</template>
</k-icon>
</template>
</k-tabbar-link>
</k-tabbar>
<k-list strong inset>
<k-list-item title="Tabbar Labels">
<template #after>
<k-toggle
:checked="isTabbarLabels"
@change="() => (isTabbarLabels = !isTabbarLabels)"
/>
</template>
</k-list-item>
<k-list-item title="Tabbar Icons">
<template #after>
<k-toggle
:checked="isTabbarIcons"
@change="() => (isTabbarIcons = !isTabbarIcons)"
/>
</template>
</k-list-item>
</k-list>
<k-block v-if="activeTab === 'tab-1'" strong inset class="space-y-4">
<p>
<b>Tab 1</b>
</p>
<p>
<span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias
accusantium necessitatibus, nihil quas praesentium at quibusdam
cupiditate possimus et repudiandae dolorum delectus quo, similique
voluptatem magni explicabo adipisci magnam ratione!
</span>
<span>
Quod praesentium consequatur autem veritatis, magni alias consectetur
ut quo, voluptatum earum in repellat! Id, autem! Minus suscipit, ad
possimus non voluptatem aliquam praesentium earum corrupti optio velit
tenetur numquam?
</span>
<span>
Illo id ipsa natus quidem dignissimos odio dolore veniam, accusamus
vel assumenda nulla aliquam amet distinctio! Debitis deserunt, et, cum
voluptate similique culpa assumenda inventore, facilis eveniet iure
optio velit.
</span>
<span>
Maiores minus laborum placeat harum impedit, saepe veniam iusto
voluptates delectus omnis consectetur tenetur ex ipsa error debitis
aspernatur amet et alias! Sit odit cum voluptas quae? Est, omnis eos?
</span>
</p>
</k-block>
<k-block v-if="activeTab === 'tab-2'" strong inset class="space-y-4">
<p>
<b>Tab 2</b>
</p>
<p>
<span>
Dicta beatae repudiandae ab pariatur mollitia praesentium fuga ipsum
adipisci, quia nam expedita, est dolore eveniet, dolorum obcaecati?
Veniam repellendus mollitia sapiente minus saepe voluptatibus
necessitatibus laboriosam incidunt nihil autem.
</span>
<span>
Officia pariatur qui, deleniti eum, et minus nisi aliquam nobis hic
provident quisquam quidem voluptatem eveniet ducimus. Commodi ea
dolorem, impedit eaque dolor, sint blanditiis magni accusantium natus
reprehenderit minima?
</span>
<span>
Dicta reiciendis ut vitae laborum aut repellendus quasi beatae nulla
sapiente et. Quod distinctio velit, modi ipsam exercitationem iste
quia eaque blanditiis neque rerum optio, nulla tenetur pariatur ex
officiis.
</span>
<span>
Consectetur accusamus delectus sit voluptatem at esse! Aperiam unde
maxime est nemo dicta minus autem esse nobis quibusdam iusto,
reprehenderit harum, perferendis quae. Ipsum sit fugit similique
recusandae quas inventore?
</span>
</p>
</k-block>
<k-block v-if="activeTab === 'tab-3'" strong inset class="space-y-4">
<p>
<b>Tab 3</b>
</p>
<p>
<span>
Vero esse ab natus neque commodi aut quidem nobis. Unde, quam
asperiores. A labore quod commodi autem explicabo distinctio saepe ex
amet iste recusandae porro consectetur, sed dolorum sapiente
voluptatibus?
</span>
<span>
Commodi ipsum, voluptatem obcaecati voluptatibus illum hic aliquam
veritatis modi natus unde, assumenda expedita, esse eum fugit? Saepe
aliquam ipsam illum nihil facilis, laborum quia, eius ea dolores
molestias dicta.
</span>
<span>
Consequatur quam laudantium, magnam facere ducimus tempora temporibus
omnis cupiditate obcaecati tempore? Odit qui a, voluptas eveniet
similique, doloribus eum dolorum ad, enim ea itaque voluptates porro
minima. Omnis, magnam.
</span>
<span>
Debitis, delectus! Eligendi excepturi rem veritatis, ad exercitationem
tempore eveniet voluptates aut labore harum dolorem nemo repellendus
accusantium quibusdam neque? Itaque iusto quisquam reprehenderit
aperiam maiores dicta iure necessitatibus est.
</span>
</p>
</k-block>
</k-page>
</template>
<script>
import { ref } from 'vue';
import {
kPage,
kNavbar,
kNavbarBackLink,
kTabbar,
kTabbarLink,
kBlock,
kIcon,
kList,
kListItem,
kToggle,
} from 'konsta/vue';
import {
EnvelopeFill,
Calendar,
CloudUploadFill,
} from 'framework7-icons/vue';
import MdEmail from '../components/MdEmail.vue';
import MdToday from '../components/MdToday.vue';
import MdFileUpload from '../components/MdFileUpload.vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kTabbar,
kTabbarLink,
kBlock,
kIcon,
kList,
kListItem,
kToggle,
EnvelopeFill,
Calendar,
CloudUploadFill,
MdEmail,
MdToday,
MdFileUpload,
},
setup() {
const activeTab = ref('tab-1');
const isTabbarLabels = ref(true);
const isTabbarIcons = ref(true);
return {
activeTab,
isTabbarLabels,
isTabbarIcons,
};
},
};
</script>
代码许可证下 MIT.
2022 © Konsta UI 由 nolimits4web.