日期格式化

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
+2 -14
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: {