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

导航栏 Vue 组件

导航栏是屏幕顶部的一个固定区域,包含页面标题和导航元素。

包含以下组件

  • 导航栏
  • 导航栏返回链接
名称类型默认描述
bgClass字符串

要添加到导航栏“背景”元素的附加类

centerTitle布尔值未定义

使导航栏标题居中。如果没有指定,则在 iOS 主题中将其设置为居中

颜色对象

包含 Tailwind CSS 颜色类的对象

colors.bgIos字符串'bg-ios-light-surface-2 dark:bg-ios-dark-surface-2'
colors.bgMaterial字符串'bg-md-light-surface-2 dark:bg-md-dark-surface-2'
colors.textIos字符串'text-black dark:text-white'
colors.textMaterial字符串'text-md-light-on-surface dark:text-md-dark-on-surface'
组件字符串'div'

组件的 HTML 元素

fontSizeIos字符串'text-[17px]'

iOS 主题中字体大小的 Tailwind CSS 类

fontSizeMaterial字符串'text-[16px]'

Material 主题中字体大小的 Tailwind CSS 类

innerClass字符串

要添加到导航栏“内部”元素的附加类

布尔值错误的

呈现带有用于大尺寸标题的额外行的较大导航栏,该标题在滚动时变为通常的大小

离开字符串

导航栏“左侧”区域的内容

leftClass字符串

要添加到导航栏“左侧”元素的附加类

中等布尔值错误的

呈现带有用于中等尺寸标题的额外行的中等尺寸导航栏,该标题在滚动时变为通常的大小

大纲布尔值未定义

呈现外部发际线(边框)。如果没有指定,将在 iOS 主题中启用

正确的字符串

导航栏“右侧”区域的内容

rightClass字符串

要添加到导航栏“右侧”元素的附加类

scrollEl任何未定义

中等/大/透明导航栏的正确“折叠”功能所需的元素。如果没有指定,它将使用导航栏的父元素

子导航栏字符串

导航栏“子导航栏”区域的内容

subnavbarClass字符串

要添加到导航栏“子导航栏”元素的附加类

副标题字符串

导航栏“副标题”区域的内容

subtitleClass字符串

要添加到导航栏“副标题”元素的附加类

标题字符串

导航栏“标题”区域的内容

titleClass字符串

要添加到导航栏“标题”元素的附加类

titleFontSizeIos字符串'text-[17px]'

iOS 主题中导航栏标题字体大小的 Tailwind CSS 类

titleFontSizeMaterial字符串'text-[22px]'

Material 主题中导航栏标题字体大小的 Tailwind CSS 类

titleLargeFontSizeIos字符串'text-[34px]'

iOS 主题中大尺寸导航栏标题字体大小的 Tailwind CSS 类

titleLargeFontSizeMaterial字符串'text-[28px]'

Material 主题中大尺寸导航栏标题字体大小的 Tailwind CSS 类

titleMediumFontSizeIos字符串'text-[24px]'

iOS 主题中中等尺寸导航栏标题字体大小的 Tailwind CSS 类

titleMediumFontSizeMaterial字符串'text-[24px]'

Material 主题中中等尺寸导航栏标题字体大小的 Tailwind CSS 类

半透明布尔值真的

在 iOS 主题中使导航栏背景半透明(使用 backdrop-filter: blur

透明布尔值错误的

呈现透明导航栏,该导航栏在滚动时变为不透明

名称描述
离开

导航栏“左侧”区域的内容

正确的

导航栏“右侧”区域的内容

子导航栏

导航栏“子导航栏”区域的内容

副标题

导航栏“副标题”区域的内容

标题

导航栏“标题”区域的内容

NavbarBackLink 应放在导航栏的“左侧”区域

<k-navbar title="My App">
  <template #left>
    <k-navbar-back-link text="Back" @click="() => history.back()" />
  </template>
</k-navbar>
名称类型默认描述
组件字符串'a'

组件的 HTML 元素

showText布尔值 | '自动''自动'

定义是否显示链接文本。当“自动”时,它会隐藏 Material 主题的链接文本

文本字符串'后退'

返回链接的文本内容

名称描述
文本

返回链接的文本内容

例子

Navbar.vue
<template>
<k-page>
<k-navbar
title="Navbar"
subtitle="Subtitle"
class="top-0 sticky"
:medium="size === 'Medium'"
:large="size === 'Large'"
:transparent="isTransparent"
>
<template #right>
<k-link navbar>Right</k-link>
</template>
</k-navbar>
<div class="relative">
<k-block strong inset>
<p>
Navbar is a fixed area at the top of a screen that contains Page title
and navigation elements.
</p>
</k-block>
<k-block-title>Size</k-block-title>
<k-block-header>
Medium and Large will collapse to usual size on page scroll
</k-block-header>
<k-list strong inset>
<k-list-item
v-for="v in ['Default', 'Medium', 'Large']"
:key="v"
label
:title="v"
>
<template #after>
<k-radio
component="div"
:value="v"
:checked="size === v"
@change="() => (size = v)"
/>
</template>
</k-list-item>
</k-list>
<k-block-title>Transparent</k-block-title>
<k-block-header>
When navbar is transparent, its title and background will become visible
on page scroll
</k-block-header>
<k-list strong inset>
<k-list-item label title="Transparent">
<template #after>
<k-toggle
component="div"
:checked="isTransparent === true"
@change="() => (isTransparent = !isTransparent)"
/>
</template>
</k-list-item>
</k-list>
<k-block strong inset class="space-y-4">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto tempore
ratione unde accusantium distinctio nulla quia numquam earum odio,
optio, nisi rem deserunt. Molestiae delectus, ut assumenda numquam
magni enim.
</p>
<p>
Architecto molestias cum dolor dolorem provident consequuntur incidunt
sunt fugiat tenetur odio, recusandae placeat rem veniam. Voluptates,
repellendus odit, magni nesciunt, optio laborum asperiores repudiandae
consectetur suscipit ab cupiditate eum.
</p>
<p>
Aliquam, iste accusamus deleniti temporibus exercitationem neque
perferendis optio, blanditiis quisquam molestias perspiciatis cumque
harum tenetur veniam. Dolorum fugit doloribus est, deserunt, eligendi,
quaerat quidem itaque tempore laborum non illum?
</p>
<p>
Rerum magni sunt quis veniam, dolor ratione saepe ducimus tempore
voluptatum porro quod commodi? Aperiam laudantium deleniti totam
dolorum qui accusantium iste saepe facere optio, soluta maxime
mollitia deserunt cumque.
</p>
<p>
Iusto tempore quis provident, saepe illum ex ipsum cupiditate
explicabo ratione unde facere nemo delectus harum, blanditiis eius sit
asperiores nam. Aut cupiditate est tempore officia, perspiciatis esse
asperiores repudiandae?
</p>
<p>
Consequuntur itaque harum eos vero, reiciendis dolorum iure non earum
molestias tenetur sint enim, maxime recusandae ad perferendis
repudiandae! Sit, quos exercitationem beatae numquam laborum nobis
natus. Obcaecati, ea inventore.
</p>
<p>
Fugit culpa labore sapiente excepturi reiciendis, nulla, nihil neque
ut veritatis quis quibusdam dolorum? Voluptatibus animi officia
perspiciatis doloremque cum voluptatem, quia ratione modi vero,
consequatur ipsum, praesentium quibusdam amet?
</p>
<p>
Laudantium nihil sint nam placeat, nemo rerum ipsam explicabo iusto
dolores molestiae expedita eos consequuntur ut architecto consequatur
soluta ad maiores voluptatem tenetur in velit. Minima quia molestiae
nobis voluptatibus.
</p>
<p>
Expedita soluta quia inventore et placeat id exercitationem quisquam
eligendi est eius sapiente quo, cum nesciunt mollitia, sit veniam
ducimus tempora culpa adipisci commodi in autem nihil voluptatem
corporis? Perspiciatis.
</p>
<p>
Molestias, est? Eligendi vero distinctio voluptatem cumque id
voluptatibus, officia minima repellendus sit illo tempora labore
provident? Eum tenetur consectetur quae, in facilis autem ipsam
doloribus voluptate vitae suscipit nobis.
</p>
<p>
Obcaecati optio iste hic, soluta minus ullam, perferendis pariatur non
possimus autem nostrum libero sapiente. Corporis quo cum iusto
exercitationem velit. Non beatae eveniet asperiores ipsa consequuntur
temporibus sapiente earum!
</p>
<p>
Temporibus, omnis. Excepturi dolorum expedita laudantium quasi quod id
adipisci, esse, nam atque in, incidunt ex ab distinctio repellendus
beatae voluptatem alias odit illum quis. Illo numquam voluptatibus
error voluptatum!
</p>
</k-block>
</div>
</k-page>
</template>
<script>
import { ref } from 'vue';
import {
kPage,
kNavbar,
kNavbarBackLink,
kLink,
kBlock,
kBlockTitle,
kBlockHeader,
kList,
kListItem,
kRadio,
kToggle,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kLink,
kBlock,
kBlockTitle,
kBlockHeader,
kList,
kListItem,
kRadio,
kToggle,
},
setup() {
const size = ref('Default');
const isTransparent = ref(false);
return {
size,
isTransparent,
};
},
};
</script>
Subnavbar.vue
<template>
<k-page>
<k-navbar title="Subnavbar">
<template #subnavbar>
<k-segmented strong>
<k-segmented-button small strong active> Button </k-segmented-button>
<k-segmented-button small strong> Button </k-segmented-button>
<k-segmented-button small strong> Button </k-segmented-button>
</k-segmented>
</template>
</k-navbar>
<div class="relative">
<k-block strong-ios outline-ios>
<p>
Subnavbar is useful when you need to put any additional elements into
Navbar, like Tab Links or Search Bar. It also remains visible when
Navbar hidden.
</p>
</k-block>
</div>
</k-page>
</template>
<script>
import {
kPage,
kNavbar,
kNavbarBackLink,
kBlock,
kSegmented,
kSegmentedButton,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kBlock,
kSegmented,
kSegmentedButton,
},
};
</script>
代码根据 麻省理工学院.
2022 © Konsta UI 由 nolimits4web.