parent
8fc9f0f655
commit
b332a97a1a
@ -0,0 +1,55 @@ |
||||
const isNullOrEmpty = function(val) { |
||||
if (val == null || val == "" || typeof(val) == undefined) { |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
const timeFormat = (value, format) => { |
||||
let date = new Date(value); |
||||
let y = date.getFullYear(); |
||||
let m = date.getMonth() + 1; |
||||
let d = date.getDate(); |
||||
let h = date.getHours(); |
||||
let min = date.getMinutes(); |
||||
let s = date.getSeconds(); |
||||
let result = ""; |
||||
if (format == undefined) { |
||||
result = `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d} ${ |
||||
h < 10 ? "0" + h : h |
||||
}:${min < 10 ? "0" + min : min}:${s < 10 ? "0" + s : s}`;
|
||||
} |
||||
if (format == "yyyy-mm-dd hh:mm") { |
||||
result = `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d} `; |
||||
} |
||||
if (format == "yyyy-mm-dd") { |
||||
result = `${y}-${m < 10 ? "0" + m : m}-${d < 10 ? "0" + d : d}`; |
||||
} |
||||
if (format == "yyyy-mm") { |
||||
result = `${y}-${m < 10 ? "0" + m : m}`; |
||||
} |
||||
if (format == "mm-dd") { |
||||
result = ` ${mm < 10 ? "0" + mm : mm}:${ddmin < 10 ? "0" + dd : dd}`; |
||||
} |
||||
if (format == "hh:mm") { |
||||
result = ` ${h < 10 ? "0" + h : h}:${min < 10 ? "0" + min : min}`; |
||||
} |
||||
if (format == "yyyy") { |
||||
result = `${y}`; |
||||
} |
||||
return result; |
||||
}; |
||||
|
||||
|
||||
// {{date|isNullOrEmpty}}
|
||||
// {{date|timeFormat('yyyy-mm-dd')}}
|
||||
// {{date|timeFormat('yyyy-mm')}}
|
||||
// {{date|timeFormat('hh:mm')}}
|
||||
// {{date|timeFormat('yyyy')}}
|
||||
// {{date|timeFormat}}
|
||||
|
||||
export { |
||||
isNullOrEmpty, |
||||
timeFormat |
||||
} |
@ -1,12 +1,20 @@ |
||||
import Vue from 'vue' |
||||
import App from './App' |
||||
import {VueJsonp} from 'vue-jsonp' |
||||
import * as filters from './Utils/js/date.js' |
||||
import { |
||||
VueJsonp |
||||
} from 'vue-jsonp' |
||||
import share from 'common/share.js' |
||||
|
||||
Object.keys(filters).forEach(key => { |
||||
Vue.filter(key, filters[key]) |
||||
}) |
||||
|
||||
Vue.config.productionTip = false |
||||
Vue.use(VueJsonp) |
||||
App.mpType = 'app' |
||||
Vue.mixin(share) |
||||
const app = new Vue({ |
||||
...App |
||||
...App |
||||
}) |
||||
app.$mount() |
||||
|
Loading…
Reference in new issue