Skip to content

Commit 24a2ccb

Browse files
committed
fix: err no homeImg config&NaN in timeLine page
1 parent 8a1902e commit 24a2ccb

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

components/HomeBlog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="home-blog" :class="recoShow?'reco-show': 'reco-hide'">
3-
<div class="hero" :style="{background: `url(${$withBase($frontmatter.bgImage) || require('../images/home-bg.jpg')}) center/cover no-repeat`, ...bgImageStyle}">
3+
<div class="hero" :style="{background: `url(${$frontmatter.bgImage ? $withBase($frontmatter.bgImage) : require('../images/home-bg.jpg')}) center/cover no-repeat`, ...bgImageStyle}">
44
<h1>{{ data.heroText || $title || '午后南杂' }}</h1>
55

66
<p class="description">{{ data.tagline || $description || 'Welcome to your vuePress-theme-reco site' }}</p>

components/TimeLine.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,18 @@ export default {
7373
})
7474
}
7575
},
76+
renderTime(date) {
77+
var dateee = new Date(date).toJSON();
78+
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '').replace(/-/g,'/')
79+
},
7680
// 时间格式化
7781
dateFormat (date, type) {
78-
date = date.replace(/-/g,'/')
82+
date = this.renderTime(date)
7983
const dateObj = new Date(date)
8084
const year = dateObj.getFullYear()
8185
const mon = dateObj.getMonth() + 1
8286
const day = dateObj.getDate()
87+
console.log(dateObj)
8388
if (type == 'year') return year
8489
else return `${mon}-${day}`
8590
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepress-theme-reco",
3-
"version": "1.0.8",
3+
"version": "1.0.8-alpha.3",
44
"description": "this is a vuepress theme",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)