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

View File

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

View File

@ -28,7 +28,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
time: " 天", time: " 天",
}; };
}, },
mounted() { mounted() {
@ -37,12 +37,12 @@ export default {
}, },
methods: { methods: {
getRuntime() { 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 days = parseInt(diff / 1000 / 60 / 60 / 24);
const hours = parseInt( const hours = parseInt(
(diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60 (diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60
); );
this.time = `${days}${hours}`; this.time = `${days}`;
}, },
}, },
}; };

View File

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

View File

@ -3756,6 +3756,11 @@
"resolved" "https://registry.npmmirror.com/module-alias/-/module-alias-2.2.2.tgz" "resolved" "https://registry.npmmirror.com/module-alias/-/module-alias-2.2.2.tgz"
"version" "2.2.2" "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": "mrmime@^1.0.0":
"integrity" "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==" "integrity" "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw=="
"resolved" "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz" "resolved" "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz"