diff --git a/common/dateUtils.js b/common/dateUtils.js new file mode 100644 index 0000000..835d376 --- /dev/null +++ b/common/dateUtils.js @@ -0,0 +1,22 @@ +Date.prototype.format = function(format) { + var o = { + "M+": this.getMonth() + 1, //month + "d+": this.getDate(), //day + "h+": this.getHours(), //hour + "m+": this.getMinutes(), //minute + "s+": this.getSeconds(), //second + "q+": Math.floor((this.getMonth() + 3) / 3), //quarter + "S": this.getMilliseconds() //millisecond + } + + if (/(y+)/.test(format)) { + format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + } + + for (var k in o) { + if (new RegExp("(" + k + ")").test(format)) { + format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); + } + } + return format; +} diff --git a/main.js b/main.js index 8558c9f..2a36d73 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,7 @@ import Vue from 'vue' import App from './App' import store from './store' +import './common/dateUtils' Vue.config.productionTip = false diff --git a/manifest.json b/manifest.json index fea9783..9394a07 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "hello-uni-app", + "name" : "humitureApp", "appid" : "__UNI__1E9AE51", "description" : "", "versionName" : "1.0.0", diff --git a/pages/device/device.vue b/pages/device/device.vue index 4144a0a..59831a2 100644 --- a/pages/device/device.vue +++ b/pages/device/device.vue @@ -1,39 +1,29 @@