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) {