Tabbar 是 Toolbar 的一个特例,但它包含图标(或带标签的图标),而不是普通链接,并且旨在用于切换标签
包含以下组件
标签栏
标签栏链接
Tabbar
组件扩展了 Toolbar
组件,它支持所有 Toolbar
属性 以及以下附加属性
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
icons | 布尔值 | false | 启用带图标的标签栏 |
labels | 布尔值 | false | 启用带标签的标签栏 |
TabbarLink
组件扩展了 Link
组件,它支持所有 Link
属性 以及以下附加属性
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
active | 布尔值 | false | 使此标签栏链接处于活动状态 |
label | 字符串 | 链接标签内容 | |
linkProps | 任何 | 包含要传递给 Link/Button 的附加属性(属性)的对象 |
名称 | 描述 |
---|---|
icon | 链接图标内容 |
label | 链接标签内容 |
<script>import {Page,Navbar,NavbarBackLink,Tabbar,TabbarLink,Block,Icon,List,ListItem,Toggle,} from 'konsta/svelte';import {EnvelopeFill,Calendar,CloudUploadFill,} from 'framework7-icons/svelte';import MdEmail from '../components/MdEmail.svelte';import MdToday from '../components/MdToday.svelte';import MdFileUpload from '../components/MdFileUpload.svelte';let activeTab = 'tab-1';let isTabbarLabels = true;let isTabbarIcons = true;</script><Page><Navbar title="Tabbar" /><Tabbarlabels={isTabbarLabels}icons={isTabbarIcons}class="left-0 bottom-0 fixed">{#if isTabbarIcons}<TabbarLinkactive={activeTab === 'tab-1'}onClick={() => (activeTab = 'tab-1')}label={isTabbarLabels ? 'Tab 1' : undefined}><svelte:fragment slot="icon"><Icon><EnvelopeFill slot="ios" class="w-7 h-7" /><MdEmail slot="material" class="w-6 h-6" /></Icon></svelte:fragment></TabbarLink><TabbarLinkactive={activeTab === 'tab-2'}onClick={() => (activeTab = 'tab-2')}label={isTabbarLabels ? 'Tab 2' : undefined}><svelte:fragment slot="icon"><Icon><Calendar slot="ios" class="w-7 h-7" /><MdToday slot="material" class="w-6 h-6" /></Icon></svelte:fragment></TabbarLink><TabbarLinkactive={activeTab === 'tab-3'}onClick={() => (activeTab = 'tab-3')}label={isTabbarLabels ? 'Tab 3' : undefined}><svelte:fragment slot="icon"><Icon><CloudUploadFill slot="ios" class="w-7 h-7" /><MdFileUpload slot="material" class="w-6 h-6" /></Icon></svelte:fragment></TabbarLink>{:else}<TabbarLinkactive={activeTab === 'tab-1'}onClick={() => (activeTab = 'tab-1')}label={isTabbarLabels ? 'Tab 1' : undefined}/><TabbarLinkactive={activeTab === 'tab-2'}onClick={() => (activeTab = 'tab-2')}label={isTabbarLabels ? 'Tab 2' : undefined}/><TabbarLinkactive={activeTab === 'tab-3'}onClick={() => (activeTab = 'tab-3')}label={isTabbarLabels ? 'Tab 3' : undefined}/>{/if}</Tabbar><List strong inset><ListItem title="Tabbar Labels"><Toggleslot="after"checked={isTabbarLabels}onChange={() => (isTabbarLabels = !isTabbarLabels)}/></ListItem><ListItem title="Tabbar Icons"><Toggleslot="after"checked={isTabbarIcons}onChange={() => (isTabbarIcons = !isTabbarIcons)}/></ListItem></List>{#if activeTab === 'tab-1'}<Block strong inset class="space-y-4"><p><b>Tab 1</b></p><p><span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliasaccusantium necessitatibus, nihil quas praesentium at quibusdamcupiditate possimus et repudiandae dolorum delectus quo, similiquevoluptatem magni explicabo adipisci magnam ratione!</span><span>Quod praesentium consequatur autem veritatis, magni alias consecteturut quo, voluptatum earum in repellat! Id, autem! Minus suscipit, adpossimus non voluptatem aliquam praesentium earum corrupti optio velittenetur numquam?</span><span>Illo id ipsa natus quidem dignissimos odio dolore veniam, accusamusvel assumenda nulla aliquam amet distinctio! Debitis deserunt, et, cumvoluptate similique culpa assumenda inventore, facilis eveniet iureoptio velit.</span><span>Maiores minus laborum placeat harum impedit, saepe veniam iustovoluptates delectus omnis consectetur tenetur ex ipsa error debitisaspernatur amet et alias! Sit odit cum voluptas quae? Est, omnis eos?</span></p></Block>{/if}{#if activeTab === 'tab-2'}<Block strong inset class="space-y-4"><p><b>Tab 2</b></p><p><span>Dicta beatae repudiandae ab pariatur mollitia praesentium fuga ipsumadipisci, quia nam expedita, est dolore eveniet, dolorum obcaecati?Veniam repellendus mollitia sapiente minus saepe voluptatibusnecessitatibus laboriosam incidunt nihil autem.</span><span>Officia pariatur qui, deleniti eum, et minus nisi aliquam nobis hicprovident quisquam quidem voluptatem eveniet ducimus. Commodi eadolorem, impedit eaque dolor, sint blanditiis magni accusantium natusreprehenderit minima?</span><span>Dicta reiciendis ut vitae laborum aut repellendus quasi beatae nullasapiente et. Quod distinctio velit, modi ipsam exercitationem istequia eaque blanditiis neque rerum optio, nulla tenetur pariatur exofficiis.</span><span>Consectetur accusamus delectus sit voluptatem at esse! Aperiam undemaxime est nemo dicta minus autem esse nobis quibusdam iusto,reprehenderit harum, perferendis quae. Ipsum sit fugit similiquerecusandae quas inventore?</span></p></Block>{/if}{#if activeTab === 'tab-3'}<Block strong inset class="space-y-4"><p><b>Tab 3</b></p><p><span>Vero esse ab natus neque commodi aut quidem nobis. Unde, quamasperiores. A labore quod commodi autem explicabo distinctio saepe examet iste recusandae porro consectetur, sed dolorum sapientevoluptatibus?</span><span>Commodi ipsum, voluptatem obcaecati voluptatibus illum hic aliquamveritatis modi natus unde, assumenda expedita, esse eum fugit? Saepealiquam ipsam illum nihil facilis, laborum quia, eius ea doloresmolestias dicta.</span><span>Consequatur quam laudantium, magnam facere ducimus tempora temporibusomnis cupiditate obcaecati tempore? Odit qui a, voluptas evenietsimilique, doloribus eum dolorum ad, enim ea itaque voluptates porrominima. Omnis, magnam.</span><span>Debitis, delectus! Eligendi excepturi rem veritatis, ad exercitationemtempore eveniet voluptates aut labore harum dolorem nemo repellendusaccusantium quibusdam neque? Itaque iusto quisquam reprehenderitaperiam maiores dicta iure necessitatibus est.</span></p></Block>{/if}</Page>