日期格式化

This commit is contained in:
结发受长生 2018-06-19 14:21:50 +08:00
parent 0b0053c07e
commit 343fa3f9d9
5 changed files with 14 additions and 26 deletions

View File

@ -18,7 +18,6 @@ timezone:
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.colorfulsweet.site
# url: http://localhost:6603
root: /
permalink: :title/
permalink_defaults:
@ -83,9 +82,9 @@ theme: yilia
#----------------------------
# 搜索
#----------------------------
search:
path: search.xml
field: all
# search:
# path: search.xml
# field: all
# Deployment
## Docs: https://hexo.io/docs/deployment.html
@ -97,6 +96,7 @@ deploy:
jsonContent:
meta: false
pages: false
dateFormat: YYYY-MM-DD
posts:
title: true
date: true

View File

@ -1 +1 @@
<%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.5ca5d3094d7d23f182cf.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %>
<%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.f9a33fdc5a046f675ae0.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %>

View File

@ -85,19 +85,19 @@
</p>
<li class="search-li" v-for="item in items" v-show="!item.isHide">
<a :href="item.path|urlformat" class="search-title"><i class="icon-quo-left icon"></i>
<span>{{item.title}}</span>
<span v-text="item.title"></span>
</a>
<p class="search-time">
<i class="icon-calendar icon"></i>
<span >{{item.date|dateformat}}</span>
<span v-text="item.date"></span>
</p>
<p class="search-category" v-if="item.categories.length">
<i class="icon-book icon" ></i>
<span v-for="category in item.categories" @click="chose(category.name, '$')" >{{category.name}}</span>
<span v-for="category in item.categories" @click="chose(category.name, '$')" v-text="category.name"></span>
</p>
<p class="search-tag" v-if="item.tags.length">
<i class="icon-price-tags icon" ></i>
<span v-for="tag in item.tags" @click="chose(tag.name, '#')" >{{tag.name}}</span>
<span v-for="tag in item.tags" @click="chose(tag.name, '#')" v-text="tag.name"></span>
</p>
</li>
</ul>

View File

@ -8,18 +8,13 @@ import Vue from './vue.min'
const isMobile = (Browser.versions.mobile && window.screen.width < 800)
function fixzero(str) {
str = str + ''
return str.length === 1 ? '0' + str : str
}
function setScrollZero() {
let $sct = document.querySelectorAll('.tools-section')
Array.prototype.forEach.call($sct, (em) => {
em.scrollTop = 0
})
}
let vm = new Vue({
new Vue({
el: '#container',
data: {
isCtnShow: false,
@ -64,14 +59,7 @@ let vm = new Vue({
},
filters: {
urlformat: (str) => {
if (window.yiliaConfig && window.yiliaConfig.root) {
return window.yiliaConfig.root + str
}
return '/' + str
},
dateformat: (str) => {
let d = new Date(str)
return d.getFullYear() + '-' + fixzero((d.getMonth() + 1)) + '-' + fixzero(d.getDate())
return (window.yiliaConfig && window.yiliaConfig.root) ? window.yiliaConfig.root + str : '/' + str;
}
},
watch: {