Merge pull request #73 from SigureMo/feature/sigure
fix: fix unpublished doc shown in tags page
This commit is contained in:
commit
fa41354f8f
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user