Merge pull request #18 from recoluan/feature/0.x
1. 更新keys报错;2. 优化时间轴列表按时间降序
This commit is contained in:
commit
2d4f3449bd
@ -132,10 +132,11 @@ export default {
|
||||
const keyPage = this.$site.themeConfig.keyPage
|
||||
if (!keyPage) {
|
||||
this.isHasKey = true
|
||||
return
|
||||
}
|
||||
|
||||
const {keys} = keyPage
|
||||
this.isHasKey = keys.indexOf(sessionStorage.getItem('key')) > -1
|
||||
|
||||
const keys = keyPagekeys
|
||||
this.isHasKey = keys && keys.indexOf(sessionStorage.getItem('key')) > -1
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -67,8 +67,8 @@ export default {
|
||||
},
|
||||
isHasKey () {
|
||||
const keyPage = this.$site.themeConfig.keyPage
|
||||
const {keys} = keyPage
|
||||
return keys.indexOf(sessionStorage.getItem('key')) > -1
|
||||
const keys = keyPage.keys
|
||||
return keys && keys.indexOf(sessionStorage.getItem('key')) > -1
|
||||
},
|
||||
inputFocus () {
|
||||
this.warningText = 'Input Your Key'
|
||||
|
@ -2,10 +2,10 @@
|
||||
<div>
|
||||
<ul class="timeline-wrapper">
|
||||
<li class="desc">Yesterday Once More!</li>
|
||||
<li v-for="(item, index) in formatPagesArr">
|
||||
<li v-for="(item, index) in formatPagesArr" :key="index">
|
||||
<h3 class="year">{{item.year}}</h3>
|
||||
<ul class="year-wrapper">
|
||||
<li v-for="(subItem, subIndex) in item.data">
|
||||
<li v-for="(subItem, subIndex) in item.data" :key="subIndex">
|
||||
<span class="date">{{dateFormat(new Date(subItem.frontmatter.date))}}</span>
|
||||
<span class="title" @click="go(subItem.path)">{{subItem.title}}</span>
|
||||
</li>
|
||||
@ -64,12 +64,13 @@ export default {
|
||||
this.formatPages[pageDateYear] = [page]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(let key in this.formatPages) {
|
||||
this.formatPagesArr.unshift({
|
||||
year: key,
|
||||
data: this.formatPages[key].reverse()
|
||||
data: this.formatPages[key].sort((a, b) => {
|
||||
return this._getTimeNum(b) - this._getTimeNum(a)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -85,6 +86,10 @@ export default {
|
||||
// 跳转
|
||||
go (url) {
|
||||
this.$router.push({path: url})
|
||||
},
|
||||
// 获取时间的数字类型
|
||||
_getTimeNum (date) {
|
||||
return parseInt(new Date(date.frontmatter.date).getTime())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vuepress-theme-reco",
|
||||
"version": "0.3.9",
|
||||
"version": "0.3.10",
|
||||
"description": "this is a vuepress theme",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user