Skip to content

Commit 405276c

Browse files
author
reco_luan
authored
Merge pull request #75 from vuepress-reco/feature/reco
Feature/reco
2 parents fa41354 + f8ea79b commit 405276c

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

components/PageInfo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default {
8080
return fromatDateTime(value)
8181
} else {
8282
// 用户没有输入或者输入了 00:00:00
83-
return new Date(value).toLocaleDateString()
83+
return fromatDateTime(value, 'date')
8484
}
8585
}
8686
},

layouts/TimeLines.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default {
5454
// 根据分类获取页面数据
5555
getPages (tag) {
5656
let pages = this.$site.pages
57-
pages = this._filterPostData(pages)
57+
pages = this._filterPostData(pages, true)
5858
// reverse()是为了按时间最近排序排序
5959
this.pages = pages.length == 0 ? [] : pages
6060
for (let i = 0, length = pages.length; i < length; i++) {

mixins/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ export default {
66
const index = Math.floor(Math.random() * tagColorArr.length)
77
return tagColorArr[index]
88
},
9-
_filterPostData (posts) {
9+
_filterPostData (posts, isTimeline) {
1010
posts = posts.filter(item => {
1111
const { home, date, publish } = item.frontmatter
12-
return !(home == true || date === undefined || publish === false)
12+
return isTimeline === true
13+
? !(home == true || date === undefined || publish === false)
14+
: !(home == true || publish === false)
1315
})
1416
return posts
1517
},
@@ -23,4 +25,4 @@ export default {
2325
return parseInt(new Date(date.frontmatter.date).getTime())
2426
}
2527
}
26-
}
28+
}

styles/theme.styl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ th, td
255255
padding: 0 .6rem
256256
border-radius: $borderRadius
257257
.vcard
258+
.vquote
259+
margin-left: 0
258260
.vimg
259261
border-radius: $borderRadius
260262
box-shadow: $boxShadow

util/formatDate.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*/
77

88
// 将时间格式化成 YYYY/MM/DD HH:mm:SS
9-
export const fromatDateTime = (time) => {
9+
export function fromatDateTime (time, type) {
10+
time = time.replace(/-/g, '/')
1011
const date = new Date(time)
1112
const Y = date.getFullYear()
1213
const M = date.getMonth() + 1
@@ -17,5 +18,6 @@ export const fromatDateTime = (time) => {
1718
m = m > 9 ? m : '0' + m
1819
let S = date.getSeconds()
1920
S = S > 9 ? S : '0' + S
20-
return Y + '/' + M + '/' + D + ' ' + H + ':' + m + ':' + S
21-
}
21+
const dt = type === 'date' ? Y + '/' + M + '/' + D : Y + '/' + M + '/' + D + ' ' + H + ':' + m + ':' + S
22+
return dt
23+
}

0 commit comments

Comments
 (0)