系统栏
v-system-bar
组件可用于向用户显示状态。它看起来像 Android 系统栏,可以包含图标、分隔符和一些文本。
用例
v-system-bar
最简单的形式是显示一个默认主题的容器。
template
<template>
<v-system-bar></v-system-bar>
</template>
API
从下面选择您想要的组件,并查看可用的属性、插槽、事件和函数。
实战场
template script
<template>
<v-row justify="center" align="center">
<v-container fluid>
<v-card img="https://cdn.vuetifyjs.com/images/home/vuetify_layout1.svg" height="200px" class="mb-6">
<v-system-bar
color="orange"
:height="height"
:lights-out="lightsOut"
:window="window"
>
<v-icon>mdi-gmail</v-icon>
<span>10 unread emails</span>
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</v-card>
</v-container>
<v-row>
<v-col cols="4">
<v-text-field
v-model="height"
class="mx-4"
label="Height - px"
max="30"
min="1"
step="1"
style="width: 125px"
type="number"
@keydown="false"
></v-text-field>
</v-col>
<v-col cols="4">
<v-switch v-model="lightsOut" label="Toggle lights-out" class="mx-4"></v-switch>
</v-col>
<v-col cols="4">
<v-switch v-model="window" label="Toggle window" class="mx-4"></v-switch>
</v-col>
</v-row>
</v-row>
</template>
<script>
export default {
data: () => ({
height: 30,
lightsOut: false,
window: false,
}),
}
</script>
示例
下面是一些简单到复杂的例子。
彩色栏
您可以通过使用 color
属性更改 v-system-bar
的颜色。
template
<template>
<div>
<v-system-bar dark color="primary">
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
<br>
<v-system-bar dark color="red lighten-2">
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
<br>
<v-system-bar dark color="indigo darken-2">
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</div>
</template>
熄灯
您可以使用 lights-out
属性来降低 v-system-bar
的不透明度。
template
<template>
<div>
<v-subheader>Lights out (light)</v-subheader>
<v-card img="https://cdn.vuetifyjs.com/images/home/vuetify_layout2.svg" height="200px">
<v-system-bar color="primary" lights-out>
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</v-card>
<v-subheader>Lights out (dark)</v-subheader>
<v-card img="https://cdn.vuetifyjs.com/images/home/vuetify_layout2.svg" height="200px">
<v-system-bar color="primary" lights-out dark>
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</v-card>
</div>
</template>
Enterprise support through Tidelift
The Tidelift Subscription is a managed open source subscription for application dependencies.
ads by Vuetify
]($a0bade116661502f.md)
主题
可以将深色或浅色主题变量应用于 v-system-bar
。
template
<template>
<div>
<v-subheader>Light status bar</v-subheader>
<v-card img="https://cdn.vuetifyjs.com/images/home/vuetify_layout1.svg" height="200px">
<v-system-bar color="primary">
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</v-card>
<v-subheader>Dark status bar</v-subheader>
<v-card img="https://cdn.vuetifyjs.com/images/home/vuetify_layout1.svg" height="200px">
<v-system-bar color="primary" dark>
<v-spacer></v-spacer>
<v-icon>mdi-wifi-strength-4</v-icon>
<v-icon>mdi-signal-cellular-outline</v-icon>
<v-icon>mdi-battery</v-icon>
<span>12:30</span>
</v-system-bar>
</v-card>
</div>
</template>
窗口栏
带有窗口控件和状态信息的窗口栏。
template
<template>
<div>
<v-system-bar window dark>
<v-icon>mdi-message</v-icon>
<span>10 unread messages</span>
<v-spacer></v-spacer>
<v-icon>mdi-minus</v-icon>
<v-icon>mdi-checkbox-blank-outline</v-icon>
<v-icon>mdi-close</v-icon>
</v-system-bar>
</div>
</template>