|
| 1 | +<template> |
| 2 | + <Footer :class="prefixCls" v-if="getShowLayoutFooter"> |
| 3 | + <div :class="`${prefixCls}__links`"> |
| 4 | + <a @click="openWindow(SITE_URL)">{{ t('layout.footer.onlinePreview') }}</a> |
| 5 | + <GithubFilled @click="openWindow(GITHUB_URL)" :class="`${prefixCls}__github`" /> |
| 6 | + <a @click="openWindow(DOC_URL)">{{ t('layout.footer.onlineDocument') }}</a> |
| 7 | + </div> |
| 8 | + <div>Copyright ©2020 Vben Admin</div> |
| 9 | + </Footer> |
| 10 | +</template> |
| 11 | + |
| 12 | +<script lang="ts"> |
| 13 | + import { computed, defineComponent, unref } from 'vue'; |
| 14 | + import { Layout } from 'ant-design-vue'; |
| 15 | +
|
| 16 | + import { GithubFilled } from '@ant-design/icons-vue'; |
| 17 | +
|
| 18 | + import { DOC_URL, GITHUB_URL, SITE_URL } from '/@/settings/siteSetting'; |
| 19 | + import { openWindow } from '/@/utils'; |
| 20 | +
|
| 21 | + import { useI18n } from '/@/hooks/web/useI18n'; |
| 22 | + import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
| 23 | + import { useRouter } from 'vue-router'; |
| 24 | + import { useDesign } from '/@/hooks/web/useDesign'; |
| 25 | +
|
| 26 | + export default defineComponent({ |
| 27 | + name: 'LayoutFooter', |
| 28 | + components: { Footer: Layout.Footer, GithubFilled }, |
| 29 | + setup() { |
| 30 | + const { t } = useI18n(); |
| 31 | + const { getShowFooter } = useRootSetting(); |
| 32 | + const { currentRoute } = useRouter(); |
| 33 | + const { prefixCls } = useDesign('layout-footer'); |
| 34 | +
|
| 35 | + const getShowLayoutFooter = computed(() => { |
| 36 | + return unref(getShowFooter) && !unref(currentRoute).meta?.hiddenFooter; |
| 37 | + }); |
| 38 | + return { getShowLayoutFooter, prefixCls, t, DOC_URL, GITHUB_URL, SITE_URL, openWindow }; |
| 39 | + }, |
| 40 | + }); |
| 41 | +</script> |
| 42 | +<style lang="less" scoped> |
| 43 | + @import (reference) '../../../design/index.less'; |
| 44 | + @prefix-cls: ~'@{namespace}-layout-footer'; |
| 45 | +
|
| 46 | + @normal-color: rgba(0, 0, 0, 0.45); |
| 47 | +
|
| 48 | + @hover-color: rgba(0, 0, 0, 0.85); |
| 49 | +
|
| 50 | + .@{prefix-cls} { |
| 51 | + color: @normal-color; |
| 52 | + text-align: center; |
| 53 | +
|
| 54 | + &__links { |
| 55 | + margin-bottom: 8px; |
| 56 | +
|
| 57 | + a { |
| 58 | + color: @normal-color; |
| 59 | +
|
| 60 | + &:hover { |
| 61 | + color: @hover-color; |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | +
|
| 66 | + &__github { |
| 67 | + margin: 0 30px; |
| 68 | +
|
| 69 | + &:hover { |
| 70 | + color: @hover-color; |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | +</style> |
0 commit comments