index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 &copy;2020 Vben Admin</div>
  9. </Footer>
  10. </template>
  11. <script lang="ts">
  12. import { computed, defineComponent, unref } 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. export default defineComponent({
  22. name: 'LayoutFooter',
  23. components: { Footer: Layout.Footer, GithubFilled },
  24. setup() {
  25. const { t } = useI18n();
  26. const { getShowFooter } = useRootSetting();
  27. const { currentRoute } = useRouter();
  28. const { prefixCls } = useDesign('layout-footer');
  29. const getShowLayoutFooter = computed(() => {
  30. return unref(getShowFooter) && !unref(currentRoute).meta?.hiddenFooter;
  31. });
  32. return { getShowLayoutFooter, prefixCls, t, DOC_URL, GITHUB_URL, SITE_URL, openWindow };
  33. },
  34. });
  35. </script>
  36. <style lang="less" scoped>
  37. @prefix-cls: ~'@{namespace}-layout-footer';
  38. @normal-color: rgba(0, 0, 0, 0.45);
  39. @hover-color: rgba(0, 0, 0, 0.85);
  40. .@{prefix-cls} {
  41. color: @normal-color;
  42. text-align: center;
  43. &__links {
  44. margin-bottom: 8px;
  45. a {
  46. color: @normal-color;
  47. &:hover {
  48. color: @hover-color;
  49. }
  50. }
  51. }
  52. &__github {
  53. margin: 0 30px;
  54. &:hover {
  55. color: @hover-color;
  56. }
  57. }
  58. }
  59. </style>