Merge pull request #74 from vuepress-reco/develop

sync develop
This commit is contained in:
reco_luan 2019-10-23 13:37:41 +08:00 committed by GitHub
commit f8ea79bd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 26 deletions

View File

@ -29,7 +29,6 @@ export default {
components: { Common, NoteAbstract, TagList }, components: { Common, NoteAbstract, TagList },
data () { data () {
return { return {
posts: [],
tags: [], tags: [],
currentTag: '全部', currentTag: '全部',
currentPage: 1, currentPage: 1,
@ -39,18 +38,26 @@ export default {
}, },
computed: { computed: {
// //
handlePosts () { posts () {
let posts = this.$site.pages const currentTag = this.currentTag
let posts = []
if (currentTag !== '全部') {
posts = this.$tags.map[currentTag].pages
} else {
posts = this.$site.pages
}
posts = this._filterPostData(posts) posts = this._filterPostData(posts)
this._sortPostData(posts) this._sortPostData(posts)
posts = posts.length == 0 ? [] : posts
this._setPage(1)
return posts return posts
} }
}, },
created () { created () {
if (this.$tags.list.length > 0) { if (this.$tags.list.length > 0) {
const currentTag = this.$route.query.tag ? this.$route.query.tag : this.currentTag this.currentTag = this.$route.query.tag ? this.$route.query.tag : this.currentTag
this.getPagesByTags(currentTag)
} }
}, },
@ -60,27 +67,9 @@ export default {
methods: { methods: {
async tagClick (currentTag) { tagClick (currentTag) {
await this.getPagesByTags(currentTag)
window.scrollTo(0, 0)
},
//
getPagesByTags (currentTag) {
this.currentTag = currentTag this.currentTag = currentTag
window.scrollTo(0, 0)
let posts = []
if (currentTag !== '全部') {
posts = this.$tags.map[currentTag].pages
this._sortPostData(posts)
} else {
posts = this.handlePosts
}
// reverse()
this.posts = posts.length == 0 ? [] : posts
this._setPage(1)
}, },
getCurrentTag (tag) { getCurrentTag (tag) {

View File

@ -83,9 +83,14 @@ color-mode(accountColor , colorName)
button button
border 1px solid accountColor!important border 1px solid accountColor!important
color accountColor!important; color accountColor!important;
.showBanNiang
background-color lighten(accountColor, 50%)!important
.banniang-container .banniang-container
.messageBox .messageBox
background-color lighten(accountColor, 50%)!important background-color lighten(accountColor, 50%)!important
.operation
i:hover
color lighten(accountColor, 50%)!important
@media (min-width: 765px) @media (min-width: 765px)
.nav-item > a:not(.external):hover, .nav-item > a:not(.external):hover,