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