共计 430 个字符,预计需要花费 2 分钟才能阅读完成。
this.startDate = '2021-06-01 12:00'
this.endDate = '2021-06-01 18: 00'
// 查看时间段有没有超过 XX 小时
checkDate() {const { startDate: st, endDate: et} = this
if (st && et) {if (st > et) {Toast.fail('开始工夫不能大于完结工夫')
this.endDate = ''
} else {const st1 = st.substr(0, 16).split(/-| |:/)
const et1 = et.substr(0, 16).split(/-| |:/)
if (st1[0] !== et1[0] || st1[1] !== et1[1] || st1[2] !== et1[2]) {Toast.fail('需抉择同一天')
this.endDate = ''
} else if (et1[3] - st1[3] > XX) {Toast.fail('时间段抉择不能超过六小时')
this.endDate = ''
}
}
}
},
正文完
发表至: javascript
2021-06-04