'install_moment'

This commit is contained in:
gtz 2023-05-21 14:11:44 +08:00
parent a1e5fe64e9
commit 7057df592a
5 changed files with 30 additions and 6 deletions

14
package-lock.json generated
View File

@ -10,6 +10,7 @@
"dependencies": {
"core-js": "^3.8.3",
"echarts": "^5.4.2",
"moment": "^2.29.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
@ -7011,6 +7012,14 @@
"dev": true,
"license": "MIT"
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"engines": {
"node": "*"
}
},
"node_modules/mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz",
@ -15415,6 +15424,11 @@
"integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==",
"dev": true
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
},
"mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz",

View File

@ -9,6 +9,7 @@
"dependencies": {
"core-js": "^3.8.3",
"echarts": "^5.4.2",
"moment": "^2.29.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.14",
"vue-router": "^3.5.1",

View File

@ -28,7 +28,7 @@ export default {
props: {},
data() {
return {
time: " 天",
time: " 天",
};
},
mounted() {
@ -37,12 +37,12 @@ export default {
},
methods: {
getRuntime() {
const diff = Date.now() - new Date("2023-5-13 10:00:00");
const diff = Date.now() - new Date("2023-5-7 8:00:00");
const days = parseInt(diff / 1000 / 60 / 60 / 24);
const hours = parseInt(
(diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60
);
this.time = `${days}${hours}`;
this.time = `${days}`;
},
},
};

View File

@ -8,18 +8,20 @@
</div>
<span class="header--wing absolute company"></span>
<span class="header--wing absolute datetime">
{{ date }} {{ week }} {{ time }}
{{ moment(today).format('YYYY.M.D dddd HH:mm:ss') }}
</span>
</header>
</template>
<script>
import moment from 'moment'
export default {
name: "Header",
data() {
return {
today: new Date(),
time: "00:00:00",
moment
};
},
computed: {
@ -39,9 +41,11 @@ export default {
},
},
mounted() {
this.time = this.getTime().join(":");
moment.locale('zh-cn')
// this.time = this.getTime().join(":");
setInterval(() => {
this.time = this.getTime().join(":");
this.today = new Date()
// this.time = this.getTime().join(":");
}, 1000);
},
methods: {

View File

@ -3756,6 +3756,11 @@
"resolved" "https://registry.npmmirror.com/module-alias/-/module-alias-2.2.2.tgz"
"version" "2.2.2"
"moment@^2.29.4":
"integrity" "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
"resolved" "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz"
"version" "2.29.4"
"mrmime@^1.0.0":
"integrity" "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw=="
"resolved" "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz"