Skip to content

Commit f8ea79b

Browse files
author
reco_luan
authored
Merge pull request #74 from vuepress-reco/develop
sync develop
2 parents c1a49a1 + fa41354 commit f8ea79b

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

layouts/Tags.vue

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export default {
2929
components: { Common, NoteAbstract, TagList },
3030
data () {
3131
return {
32-
posts: [],
3332
tags: [],
3433
currentTag: '全部',
3534
currentPage: 1,
@@ -39,18 +38,26 @@ export default {
3938
},
4039
computed: {
4140
// 时间降序后的博客列表
42-
handlePosts () {
43-
let posts = this.$site.pages
41+
posts () {
42+
const currentTag = this.currentTag
43+
let posts = []
44+
45+
if (currentTag !== '全部') {
46+
posts = this.$tags.map[currentTag].pages
47+
} else {
48+
posts = this.$site.pages
49+
}
50+
4451
posts = this._filterPostData(posts)
4552
this._sortPostData(posts)
53+
posts = posts.length == 0 ? [] : posts
54+
this._setPage(1)
4655
return posts
4756
}
4857
},
4958
created () {
5059
if (this.$tags.list.length > 0) {
51-
const currentTag = this.$route.query.tag ? this.$route.query.tag : this.currentTag
52-
53-
this.getPagesByTags(currentTag)
60+
this.currentTag = this.$route.query.tag ? this.$route.query.tag : this.currentTag
5461
}
5562
},
5663
@@ -60,27 +67,9 @@ export default {
6067
6168
methods: {
6269
63-
async tagClick (currentTag) {
64-
await this.getPagesByTags(currentTag)
65-
window.scrollTo(0, 0)
66-
},
67-
68-
// 根据分类获取页面数据
69-
getPagesByTags (currentTag) {
70+
tagClick (currentTag) {
7071
this.currentTag = currentTag
71-
72-
let posts = []
73-
if (currentTag !== '全部') {
74-
posts = this.$tags.map[currentTag].pages
75-
this._sortPostData(posts)
76-
} else {
77-
posts = this.handlePosts
78-
}
79-
80-
// reverse()是为了按时间最近排序排序
81-
this.posts = posts.length == 0 ? [] : posts
82-
83-
this._setPage(1)
72+
window.scrollTo(0, 0)
8473
},
8574
8675
getCurrentTag (tag) {

styles/colorMixin.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ color-mode(accountColor , colorName)
8383
button
8484
border 1px solid accountColor!important
8585
color accountColor!important;
86+
.showBanNiang
87+
background-color lighten(accountColor, 50%)!important
8688
.banniang-container
8789
.messageBox
8890
background-color lighten(accountColor, 50%)!important
91+
.operation
92+
i:hover
93+
color lighten(accountColor, 50%)!important
8994

9095
@media (min-width: 765px)
9196
.nav-item > a:not(.external):hover,

0 commit comments

Comments
 (0)