页脚
v-footer
用于显示用户可能希望从站点内的所有页面访问到的公共信息。
用例
最简单形式的 v-footer
组件是一个容器。
template
<template>
<v-footer>
<v-spacer></v-spacer>
<div>© {{ new Date().getFullYear() }}</div>
</v-footer>
</template>
API
从下面选择您想要的组件,并查看可用的属性、插槽、事件和函数。
实战场
template script
<template>
<v-card height="400px">
<v-footer
v-bind="localAttrs"
:padless="padless"
>
<v-card
flat
tile
width="100%"
class="red lighten-1 text-center"
>
<v-card-text>
<v-btn
v-for="icon in icons"
:key="icon"
class="mx-4"
icon
>
<v-icon size="24px">{{ icon }}</v-icon>
</v-btn>
</v-card-text>
<v-divider></v-divider>
<v-card-text class="white--text">
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-card-text>
</v-card>
</v-footer>
<v-row
align="center"
justify="center"
class="ma-12"
>
<v-col
cols="12"
md="8"
>
<v-select
v-model="variant"
:items="items"
clearable
label="Variant"
></v-select>
<v-checkbox
v-model="padless"
hide-details
label="Padless"
></v-checkbox>
</v-col>
</v-row>
</v-card>
</template>
<script>
export default {
data: () => ({
icons: [
'mdi-home',
'mdi-email',
'mdi-calendar',
'mdi-delete',
],
items: [
'default',
'absolute',
'fixed',
],
padless: false,
variant: 'default',
}),
computed: {
localAttrs () {
const attrs = {}
if (this.variant === 'default') {
attrs.absolute = false
attrs.fixed = false
} else {
attrs[this.variant] = true
}
return attrs
},
},
}
</script>
示例
下面是一些简单到复杂的例子。
绝对定位的页脚
absolute
属性将页脚放在其父容器的底部。
template
<template>
<v-card height="150">
<v-footer
absolute
class="font-weight-medium"
>
<v-col
class="text-center"
cols="12"
>
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-col>
</v-footer>
</v-card>
</template>
无垫页脚
padless
属性将从页脚组件中删除所有默认边距
template
<template>
<v-footer padless>
<v-col
class="text-center"
cols="12"
>
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-col>
</v-footer>
</template>
公司页脚
使用页脚组件制作一个包含一些页面链接的公司页脚。
template script
<template>
<v-footer
color="primary lighten-1"
padless
>
<v-row
justify="center"
no-gutters
>
<v-btn
v-for="link in links"
:key="link"
color="white"
text
rounded
class="my-2"
>
{{ link }}
</v-btn>
<v-col
class="primary lighten-2 py-4 text-center white--text"
cols="12"
>
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-col>
</v-row>
</v-footer>
</template>
<script>
export default {
data: () => ({
links: [
'Home',
'About Us',
'Team',
'Services',
'Blog',
'Contact Us',
],
}),
}
</script>
Enterprise support through Tidelift
The Tidelift Subscription is a managed open source subscription for application dependencies.
ads by Vuetify
]($a0bade116661502f.md)
靛蓝色页脚
使用页脚组件制作一个靛蓝背景以及包含一些社交媒体图标按钮的页脚。
template script
<template>
<v-footer
dark
padless
>
<v-card
flat
tile
class="indigo lighten-1 white--text text-center"
>
<v-card-text>
<v-btn
v-for="icon in icons"
:key="icon"
class="mx-4 white--text"
icon
>
<v-icon size="24px">{{ icon }}</v-icon>
</v-btn>
</v-card-text>
<v-card-text class="white--text pt-0">
Phasellus feugiat arcu sapien, et iaculis ipsum elementum sit amet. Mauris cursus commodo interdum. Praesent ut risus eget metus luctus accumsan id ultrices nunc. Sed at orci sed massa consectetur dignissim a sit amet dui. Duis commodo vitae velit et faucibus. Morbi vehicula lacinia malesuada. Nulla placerat augue vel ipsum ultrices, cursus iaculis dui sollicitudin. Vestibulum eu ipsum vel diam elementum tempor vel ut orci. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
</v-card-text>
<v-divider></v-divider>
<v-card-text class="white--text">
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-card-text>
</v-card>
</v-footer>
</template>
<script>
export default {
data: () => ({
icons: [
'mdi-facebook',
'mdi-twitter',
'mdi-linkedin',
'mdi-instagram',
],
}),
}
</script>
蓝绿色页脚
使用页脚组件制作一个蓝绿色顶部以及几个行列链接的页脚。
template script
<template>
<v-footer
dark
padless
>
<v-card
class="flex"
flat
tile
>
<v-card-title class="teal">
<strong class="subheading">Get connected with us on social networks!</strong>
<v-spacer></v-spacer>
<v-btn
v-for="icon in icons"
:key="icon"
class="mx-4"
dark
icon
>
<v-icon size="24px">{{ icon }}</v-icon>
</v-btn>
</v-card-title>
<v-card-text class="py-2 white--text text-center">
{{ new Date().getFullYear() }} — <strong>Vuetify</strong>
</v-card-text>
</v-card>
</v-footer>
</template>
<script>
export default {
data: () => ({
icons: [
'mdi-facebook',
'mdi-twitter',
'mdi-linkedin',
'mdi-instagram',
],
}),
}
</script>