Footer.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <FlexCol center :padding="padding" :backgroundColor="props.backgroundColor">
  3. <slot class="links">
  4. <FlexRow v-if="props.links?.length" wrap align="center">
  5. <template v-for="(item, i) in props.links" :key="i">
  6. <A
  7. :href="item.url"
  8. :linkType="item.type"
  9. :fontSize="props.textSize"
  10. :color="props.linkColor"
  11. v-bind="props.linkProps"
  12. @click="item.onClick"
  13. >
  14. {{ item.text }}
  15. </A>
  16. <Divider v-if="i < props.links.length - 1" type="vertical" />
  17. </template>
  18. </FlexRow>
  19. </slot>
  20. <slot class="text">
  21. <Text
  22. v-if="props.text"
  23. fontConfig="footerText"
  24. :fontSize="props.textSize"
  25. :color="props.textColor"
  26. v-bind="props.textProps"
  27. >
  28. {{ props.text }}
  29. </Text>
  30. </slot>
  31. </FlexCol>
  32. </template>
  33. <script setup lang="ts">
  34. import Text, { type TextProps } from '../basic/Text.vue';
  35. import FlexCol from '../layout/FlexCol.vue';
  36. import FlexRow from '../layout/FlexRow.vue';
  37. import A, { type AProps } from '../typography/A.vue';
  38. import Divider from './Divider.vue';
  39. export interface FooterProps {
  40. backgroundColor?: string,
  41. padding?: number|number[],
  42. text?: string,
  43. textProps?: TextProps,
  44. textSize?: number,
  45. textColor?: string,
  46. linkProps?: AProps,
  47. linkColor?: string,
  48. links?: {
  49. text: string,
  50. url: string,
  51. type: 'uni-page'|'url'|'back'|'custom',
  52. onClick?: (e: any) => void
  53. }[]
  54. }
  55. const props = withDefaults(defineProps<FooterProps>(), {
  56. padding: 20,
  57. });
  58. </script>