index.vue 2.4 KB

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