Merge pull request #56 from vuepress-reco/feature/lxb

Feature/lxb
This commit is contained in:
reco_luan 2019-10-11 14:48:35 +08:00 committed by GitHub
commit d1af57dd2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View File

@ -22,7 +22,7 @@
<script>
import AccessNumber from './Valine/AccessNumber'
//js
// js
import { fromatDateTime } from '@theme/util/formatDate.js'
export default {
@ -58,17 +58,17 @@ export default {
if (!value) return ''
// value2019-09-20T18:22:30.000Z
// value
value = value.replace('T', ' ').slice(0,value.lastIndexOf('.'))
value = value.replace('T', ' ').slice(0, value.lastIndexOf('.'))
// value 2019-09-20 18:22:30
// 00:00:00 (00:00:00)
//
const h = Number(value.substr(11, 2))
const m = Number(value.substr(14, 2))
const s = Number(value.substr(17, 2))
// > 0 00:00:00
// 00:00:00 (00:00:00)
if (h > 0 || m > 0 || s > 0) {
// > 0 00:00:00
return fromatDateTime(value)
}else {
} else {
// 00:00:00
return new Date(value).toLocaleDateString()
}
@ -84,25 +84,23 @@ export default {
</script>
<style lang="stylus" scoped>
.iconfont
display inline-block
line-height 1.5rem
&:not(:last-child)
margin-right 1rem
span
margin-left .5rem
margin-left 0.5rem
.tags
.tag-item
cursor: pointer;
font-family Ubuntu, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif
cursor pointer
font-family Ubuntu, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif
&.active
color $accentColor
&:hover
color $accentColor
@media (max-width: $MQMobile)
.tags
display block
margin-left: 0!important;
margin-left 0 !important
</style>

View File

@ -1,4 +1,4 @@
/**
/**
* 时间格式化的方法
* 创建时间2019-10-08
* 作者刘晓北