diff --git a/src/App.vue b/src/App.vue index cc9690fc087569b63d37adaaf3ec93dedba4c72e..d6bd9538afaa7ed526d6f7cf607b18eb54f5ea92 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)}分钟` + '

' + } } } },