Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 8c89670

Browse files
committed
feat: using GlobalLayout to simplify implementation
1 parent 0add205 commit 8c89670

File tree

12 files changed

+58
-121
lines changed

12 files changed

+58
-121
lines changed

components/Footer.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
</template>
2323

2424
<script>
25-
import NavLink from './NavLink'
2625
import {
2726
GithubIcon,
2827
FacebookIcon,
@@ -31,7 +30,6 @@
3130
3231
export default {
3332
components: {
34-
NavLink,
3533
GithubIcon,
3634
FacebookIcon,
3735
TwitterIcon,

components/Header.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121

2222
<script>
2323
import SearchBox from '@SearchBox'
24-
import NavLink from './NavLink'
2524
2625
export default {
27-
components: {
28-
SearchBox,
29-
NavLink,
30-
},
26+
components: { SearchBox },
3127
}
3228
</script>
3329

layouts/BaseListLayout.vue renamed to global-components/BaseListLayout.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
<template>
2-
<LayoutWrapper class="common-layout">
2+
<div id="base-list-layout">
33
<div class="ui-post" v-for="page in pages">
44
<div class="ui-post-title">
5-
<a :href="page.path">{{ page.title }}</a>
5+
<NavLink :link="page.path">{{ page.title }}</NavLink>
6+
</div>
7+
<div class="ui-post-summary">
8+
<Content :page-key="page.key" slot-key="intro"/>
69
</div>
7-
<div class="ui-post-summary"><Content :page-key="page.key" slot-key="intro" /></div>
810
<div class="ui-post-author" v-if="page.frontmatter.author">
9-
<NavigationIcon /> <span>{{ page.frontmatter.author }} in {{ page.frontmatter.location }}</span>
11+
<NavigationIcon/>
12+
<span>{{ page.frontmatter.author }} in {{ page.frontmatter.location }}</span>
1013
</div>
1114
<div class="ui-post-date" v-if="page.frontmatter.date">
12-
<ClockIcon /> <span>{{ new Date(page.frontmatter.date.trim()).toDateString() }}</span>
15+
<ClockIcon/>
16+
<span>{{ new Date(page.frontmatter.date.trim()).toDateString() }}</span>
1317
</div>
1418
</div>
15-
19+
1620
<Pagination :pagination="pagination"/>
17-
</LayoutWrapper>
21+
</div>
1822
</template>
1923

2024
<script>
@@ -26,7 +30,7 @@
2630
components: { Toc, Pagination, NavigationIcon, ClockIcon },
2731
props: ['pagination'],
2832
computed: {
29-
pages () {
33+
pages() {
3034
return this.pagination.pages
3135
}
3236
},
@@ -40,18 +44,21 @@
4044
4145
.ui-post
4246
margin-bottom 50px
47+
4348
p
4449
margin 0
4550
4651
.ui-post-title
4752
font-weight bold
4853
font-size 24px
4954
border-bottom 0
55+
5056
a
5157
cursor pointer
5258
color #000
5359
transition all .2s
5460
text-decoration none
61+
5562
&:hover
5663
text-decoration underline
5764
@@ -67,6 +74,7 @@
6774
line-height 12px
6875
color rgba(0, 0, 0, 0.84)
6976
margin-bottom 3px
77+
7078
svg
7179
margin-right 5px
7280
width 14px
@@ -77,6 +85,7 @@
7785
align-items center
7886
font-size 12px
7987
color rgba(0, 0, 0, 0.54)
88+
8089
svg
8190
margin-right 5px
8291
width 14px

global-components/BlogTag.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<router-link class="blog-tag" :to="tag.path">
3-
{{ tag.name }} ({{ tag.posts.length }})
3+
{{ tag.name }} ({{ tag.pages.length }})
44
</router-link>
55
</template>
66

global-components/LayoutWrapper.vue

Lines changed: 0 additions & 28 deletions
This file was deleted.

components/NavLink.vue renamed to global-components/NavLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</template>
2020

2121
<script>
22-
import { isExternal, isMailto, isTel, ensureExt } from './util'
22+
import { isExternal, isMailto, isTel, ensureExt } from '../components/util'
2323
2424
export default {
2525
props: {

layouts/FrontmatterClassifier2.vue

Lines changed: 0 additions & 33 deletions
This file was deleted.

layouts/GlobalLayout.vue

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div id="vuperess-theme-blog__global-layout">
3+
<Header/>
4+
<div class="content-wrapper">
5+
<DefaultGlobalLayout/>
6+
</div>
7+
<Footer/>
8+
</div>
9+
</template>
10+
11+
<script>
12+
import GlobalLayout from '@app/components/GlobalLayout.vue'
13+
import Header from '@theme/components/Header.vue'
14+
import Footer from '@theme/components/Header.vue'
15+
16+
export default {
17+
components: {
18+
DefaultGlobalLayout: GlobalLayout,
19+
Header,
20+
Footer,
21+
},
22+
}
23+
</script>
24+
25+
<style lang="stylus">
26+
.content-wrapper
27+
padding-top 160px
28+
min-height calc(100vh - 80px - 60px)
29+
max-width 740px
30+
padding-left 20vw
31+
</style>

layouts/IndexWriting.vue

Lines changed: 0 additions & 17 deletions
This file was deleted.

layouts/Layout.vue

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
<template>
2-
<BaseListLayout :pagination="pagination"/>
2+
<BaseListLayout :pagination="$pagination"/>
33
</template>
44

5-
<script>
6-
import BaseListLayout from './BaseListLayout'
7-
8-
export default {
9-
components: { BaseListLayout },
10-
computed: {
11-
pagination() {
12-
if (this.$route.meta.pid) {
13-
return this.$pagination
14-
}
15-
return this.$getPagination('post')
16-
},
17-
},
18-
}
19-
</script>
5+
<style src="prismjs/themes/prism-okaidia.css"></style>

0 commit comments

Comments
 (0)