页脚

v-footer 用于显示用户可能希望从站点内的所有页面访问到的公共信息。

用例

最简单形式的 v-footer 组件是一个容器。

template


  1. <template>
  2. <v-footer>
  3. <v-spacer></v-spacer>
  4. <div>&copy; {{ new Date().getFullYear() }}</div>
  5. </v-footer>
  6. </template>

Footer(页脚) - 图1

API

从下面选择您想要的组件,并查看可用的属性、插槽、事件和函数。

Footer(页脚) - 图2

实战场

template script


  1. <template>
  2. <v-card height="400px">
  3. <v-footer
  4. v-bind="localAttrs"
  5. :padless="padless"
  6. >
  7. <v-card
  8. flat
  9. tile
  10. width="100%"
  11. class="red lighten-1 text-center"
  12. >
  13. <v-card-text>
  14. <v-btn
  15. v-for="icon in icons"
  16. :key="icon"
  17. class="mx-4"
  18. icon
  19. >
  20. <v-icon size="24px">{{ icon }}</v-icon>
  21. </v-btn>
  22. </v-card-text>
  23. <v-divider></v-divider>
  24. <v-card-text class="white--text">
  25. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  26. </v-card-text>
  27. </v-card>
  28. </v-footer>
  29. <v-row
  30. align="center"
  31. justify="center"
  32. class="ma-12"
  33. >
  34. <v-col
  35. cols="12"
  36. md="8"
  37. >
  38. <v-select
  39. v-model="variant"
  40. :items="items"
  41. clearable
  42. label="Variant"
  43. ></v-select>
  44. <v-checkbox
  45. v-model="padless"
  46. hide-details
  47. label="Padless"
  48. ></v-checkbox>
  49. </v-col>
  50. </v-row>
  51. </v-card>
  52. </template>
  1. <script>
  2. export default {
  3. data: () => ({
  4. icons: [
  5. 'mdi-home',
  6. 'mdi-email',
  7. 'mdi-calendar',
  8. 'mdi-delete',
  9. ],
  10. items: [
  11. 'default',
  12. 'absolute',
  13. 'fixed',
  14. ],
  15. padless: false,
  16. variant: 'default',
  17. }),
  18. computed: {
  19. localAttrs () {
  20. const attrs = {}
  21. if (this.variant === 'default') {
  22. attrs.absolute = false
  23. attrs.fixed = false
  24. } else {
  25. attrs[this.variant] = true
  26. }
  27. return attrs
  28. },
  29. },
  30. }
  31. </script>

Footer(页脚) - 图3

示例

下面是一些简单到复杂的例子。

绝对定位的页脚

absolute 属性将页脚放在其父容器的底部。

template


  1. <template>
  2. <v-card height="150">
  3. <v-footer
  4. absolute
  5. class="font-weight-medium"
  6. >
  7. <v-col
  8. class="text-center"
  9. cols="12"
  10. >
  11. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  12. </v-col>
  13. </v-footer>
  14. </v-card>
  15. </template>

Footer(页脚) - 图4

无垫页脚

padless 属性将从页脚组件中删除所有默认边距

template


  1. <template>
  2. <v-footer padless>
  3. <v-col
  4. class="text-center"
  5. cols="12"
  6. >
  7. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  8. </v-col>
  9. </v-footer>
  10. </template>

Footer(页脚) - 图5

公司页脚

使用页脚组件制作一个包含一些页面链接的公司页脚。

template script


  1. <template>
  2. <v-footer
  3. color="primary lighten-1"
  4. padless
  5. >
  6. <v-row
  7. justify="center"
  8. no-gutters
  9. >
  10. <v-btn
  11. v-for="link in links"
  12. :key="link"
  13. color="white"
  14. text
  15. rounded
  16. class="my-2"
  17. >
  18. {{ link }}
  19. </v-btn>
  20. <v-col
  21. class="primary lighten-2 py-4 text-center white--text"
  22. cols="12"
  23. >
  24. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  25. </v-col>
  26. </v-row>
  27. </v-footer>
  28. </template>
  1. <script>
  2. export default {
  3. data: () => ({
  4. links: [
  5. 'Home',
  6. 'About Us',
  7. 'Team',
  8. 'Services',
  9. 'Blog',
  10. 'Contact Us',
  11. ],
  12. }),
  13. }
  14. </script>

Footer(页脚) - 图6

Enterprise support through Tidelift

The Tidelift Subscription is a managed open source subscription for application dependencies.

ads by Vuetify

]($a0bade116661502f.md)

靛蓝色页脚

使用页脚组件制作一个靛蓝背景以及包含一些社交媒体图标按钮的页脚。

template script


  1. <template>
  2. <v-footer
  3. dark
  4. padless
  5. >
  6. <v-card
  7. flat
  8. tile
  9. class="indigo lighten-1 white--text text-center"
  10. >
  11. <v-card-text>
  12. <v-btn
  13. v-for="icon in icons"
  14. :key="icon"
  15. class="mx-4 white--text"
  16. icon
  17. >
  18. <v-icon size="24px">{{ icon }}</v-icon>
  19. </v-btn>
  20. </v-card-text>
  21. <v-card-text class="white--text pt-0">
  22. 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.
  23. </v-card-text>
  24. <v-divider></v-divider>
  25. <v-card-text class="white--text">
  26. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  27. </v-card-text>
  28. </v-card>
  29. </v-footer>
  30. </template>
  1. <script>
  2. export default {
  3. data: () => ({
  4. icons: [
  5. 'mdi-facebook',
  6. 'mdi-twitter',
  7. 'mdi-linkedin',
  8. 'mdi-instagram',
  9. ],
  10. }),
  11. }
  12. </script>

Footer(页脚) - 图7

蓝绿色页脚

使用页脚组件制作一个蓝绿色顶部以及几个行列链接的页脚。

template script


  1. <template>
  2. <v-footer
  3. dark
  4. padless
  5. >
  6. <v-card
  7. class="flex"
  8. flat
  9. tile
  10. >
  11. <v-card-title class="teal">
  12. <strong class="subheading">Get connected with us on social networks!</strong>
  13. <v-spacer></v-spacer>
  14. <v-btn
  15. v-for="icon in icons"
  16. :key="icon"
  17. class="mx-4"
  18. dark
  19. icon
  20. >
  21. <v-icon size="24px">{{ icon }}</v-icon>
  22. </v-btn>
  23. </v-card-title>
  24. <v-card-text class="py-2 white--text text-center">
  25. {{ new Date().getFullYear() }} — <strong>Vuetify</strong>
  26. </v-card-text>
  27. </v-card>
  28. </v-footer>
  29. </template>
  1. <script>
  2. export default {
  3. data: () => ({
  4. icons: [
  5. 'mdi-facebook',
  6. 'mdi-twitter',
  7. 'mdi-linkedin',
  8. 'mdi-instagram',
  9. ],
  10. }),
  11. }
  12. </script>

Footer(页脚) - 图8