From 656d86b53b4385b0d659e2840eea28420f1e0b30 Mon Sep 17 00:00:00 2001 From: lihua <531456470@qq.com> Date: Sat, 15 Feb 2020 15:00:05 +0800 Subject: [PATCH] save --- common/dateUtils.js | 22 ++++++++ main.js | 1 + manifest.json | 2 +- pages/device/device.vue | 109 ++++++++++++------------------------- pages/device/real-data.vue | 35 ++++++++++++ pages/home/home.vue | 30 ---------- 6 files changed, 94 insertions(+), 105 deletions(-) create mode 100644 common/dateUtils.js create mode 100644 pages/device/real-data.vue 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 @@