From ddec39d28430862d553876ed14b50fc6d8abbeba Mon Sep 17 00:00:00 2001 From: 6281f250dc86617fa5051a8f <6281f250dc86617fa5051a8f@devide> Date: Tue, 18 Apr 2023 08:25:00 +0000 Subject: [PATCH] Tue Apr 18 08:25:00 UTC 2023 inscode --- src/App.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index cc9690f..d6bd953 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,11 +22,15 @@ export default { this.result = '' const dateList = this.txtDate.split(/\n/) for (let dateStr of dateList) { - const curArr = dateStr.split('-') - const start = new Date(`2023-03-01 ${curArr[0]}`).getTime() - const end = new Date(`2023-03-01 ${curArr[1]}`).getTime() + if(!dateStr) { + this.result += '
' + } else { + const curArr = dateStr.split('-') + const start = new Date(`2023-03-01 ${curArr[0]}`).getTime() + const end = new Date(`2023-03-01 ${curArr[1]}`).getTime() - this.result += '

' + `${dateStr}${parseFloat((end-start)/1000/60)}分钟` + '

' + this.result += '

' + `${dateStr}${parseFloat((end-start)/1000/60)}分钟` + '

' + } } } }, -- GitLab