[update] 多选日期组件对所选日期进行排序

This commit is contained in:
lideqin
2023-10-20 13:47:26 +08:00
parent 53ecb1f213
commit 36bf3e7b4f
+6 -1
View File
@@ -76,7 +76,12 @@ export default {
const currentStr = current.format('YYYY-MM-DD')
if (!this.checkedValue.includes(currentStr)) {
console.log('加日期')
this.checkedValue.push(currentStr)
const checkedValue = this.checkedValue
checkedValue.push(currentStr)
// 对日期进行排序
this.checkedValue = checkedValue.sort((date1, date2) => {
return new Date(date1) - new Date(date2)
})
} else {
console.log('减日期')
this.checkedValue = this.checkedValue.filter(item => item !== currentStr)