From 29567c53922a479128e3c488431d9a5ff8976af7 Mon Sep 17 00:00:00 2001 From: ewall555 Date: Mon, 16 Jun 2025 16:30:19 +0800 Subject: [PATCH] feat: Remove vue-moment dependency, use moment library directly --- package.json | 1 - src/main.js | 9 ++++----- yarn.lock | 29 +++++++++++++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index c7f3ee0f7..fd1bd482b 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "vue-i18n": "^8.15.5", "vue-json-editor": "^1.4.3", "vue-markdown": "^2.2.4", - "vue-moment": "^4.1.0", "vue-password-strength-meter": "^1.7.2", "vue-router": "3.0.6", "vue-select": "^3.9.5", diff --git a/src/main.js b/src/main.js index ad4cc6509..8f1c84c76 100644 --- a/src/main.js +++ b/src/main.js @@ -24,6 +24,9 @@ import { message } from '@/utils/message' import xss from '@/utils/xss' import ElTableTooltipPatch from '@/utils/elTableTooltipPatch.js' import VSanitize from 'v-sanitize' +import moment from 'moment' +moment.locale('zh-cn') + /** * If you don't want to use mock-server * you want to use MockJs for mock api @@ -50,11 +53,7 @@ Vue.config.productionTip = false Vue.use(VueCookie) window.$cookie = VueCookie -const moment = require('moment') -require('moment/locale/zh-cn') -Vue.use(require('vue-moment'), { - moment -}) +Vue.prototype.$moment = moment Vue.use(VueLogger, loggerOptions) diff --git a/yarn.lock b/yarn.lock index 2bf96f1a3..a4d2e6be8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8914,7 +8914,7 @@ moment-parseformat@^4.0.0: resolved "https://registry.npmmirror.com/moment-parseformat/-/moment-parseformat-4.0.0.tgz" integrity sha512-0V4ICKnI1npglqrMSDK2y8WxOdN79DkMoIexzY3P+jr2wNfbB4J81BgjFfHsj18wBsV7FdKCWyCHcezzH0xlyg== -moment@^2.19.2, moment@^2.29.4: +moment@^2.29.4: version "2.29.4" resolved "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== @@ -12075,7 +12075,7 @@ string-length@^2.0.0: astral-regex "^1.0.0" strip-ansi "^4.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -12093,6 +12093,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.npmmirror.com/string-width/-/string-width-2.1.1.tgz" @@ -12193,7 +12202,7 @@ stringify-package@^1.0.1: resolved "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12221,6 +12230,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-7.1.0.tgz" @@ -13215,13 +13231,6 @@ vue-markdown@^2.2.4: markdown-it-task-lists "^2.0.1" markdown-it-toc-and-anchor "^4.1.2" -vue-moment@^4.1.0: - version "4.1.0" - resolved "https://registry.npmmirror.com/vue-moment/-/vue-moment-4.1.0.tgz" - integrity sha512-Gzisqpg82ItlrUyiD9d0Kfru+JorW2o4mQOH06lEDZNgxci0tv/fua1Hl0bo4DozDV2JK1r52Atn/8QVCu8qQw== - dependencies: - moment "^2.19.2" - vue-password-strength-meter@^1.7.2: version "1.7.2" resolved "https://registry.npmmirror.com/vue-password-strength-meter/-/vue-password-strength-meter-1.7.2.tgz"