/
Page.vue
86 lines (76 loc) 路 2.07 KB
/
Page.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
<template>
<main :class="['page', { 'has-page-anchor': hasPageAnchor }]">
<slot name="top" />
<Content class="theme-antdocs-content" />
<PageEdit />
<PageNav v-bind="{ sidebarItems }" />
<PageAnchor v-if="!pageAnchorConfig.isDisabled" />
<slot name="bottom" />
</main>
</template>
<script>
import PageEdit from '@theme/components/PageEdit.vue';
import PageNav from '@theme/components/PageNav.vue';
import PageAnchor from '@theme/components/PageAnchor.vue';
// import { getLocalStorage } from '../util/index';
export default {
components: { PageEdit, PageNav, PageAnchor },
props: ['sidebarItems'],
computed: {
hasPageAnchor() {
if (this.pageAnchorConfig.isDisabled){
this.$store.state.global.isCollapsePageAnchor = true;
return false;
}
if (!this.$page.headers) {
this.$store.state.global.isCollapsePageAnchor = true;
return false;
}
this.$store.state.global.isCollapsePageAnchor = false;
return true;
// if (this.$page.headers) {
// return this.$store.state.global.isCollapsePageAnchor ||
// getLocalStorage('isCollapsePageAnchor', 'boolen')
// ? false
// : true;
// } else {
// return false;
// }
},
pageAnchorConfig() {
return (
this.$page.frontmatter.pageAnchor ||
this.$themeConfig.pageAnchor || { anchorDepth: 2, isDisabled: false }
);
}
}
};
</script>
<style lang="less">
@import '../styles/palette.less';
@import '../styles/wrapper.less';
.page {
padding-bottom: 2rem;
display: block;
// transition: padding-right 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
// .ant-btn {
// border-bottom-right-radius: 0;
// border-top-right-radius: 0;
// box-shadow: -1px 0 5px 0 #0000001a;
// }
}
.has-page-anchor {
padding-right: 12.5rem;
// .ant-btn {
// border-bottom-right-radius: 50%;
// border-top-right-radius: 50%;
// box-shadow: unset;
// }
}
@media (max-width: @MQMobile) {
.page {
margin-top: -@navbarHeight;
padding-right: 0;
}
}
</style>