From 6e8c96ce2ec4ded9d2ee41e36e45f868c153f9cd Mon Sep 17 00:00:00 2001 From: lyc Date: Thu, 15 Aug 2024 10:31:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E7=BD=AE=E4=BD=9C=E4=B8=9A=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=97=A5=E6=9C=9F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/prepare/container/set-homework.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/views/prepare/container/set-homework.vue b/src/renderer/src/views/prepare/container/set-homework.vue index c607e43..5aa5d35 100644 --- a/src/renderer/src/views/prepare/container/set-homework.vue +++ b/src/renderer/src/views/prepare/container/set-homework.vue @@ -263,9 +263,15 @@ export default { getCurrentDate() { const now = new Date(); const year = now.getFullYear(); - const month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1 - const day = now.getDate() - return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`; + let month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1 + let day = now.getDate() + if(month < 10){ + month = '0' + month + } + if(day < 10){ + day = '0' + day + } + return `${year}-${month}-${day}`; }, validateGrade(rule, value, callback) { if (this.studentList.length == 0) { -- 2.44.0.windows.1