[update] 多选日期组件对所选日期进行排序
This commit is contained in:
@@ -76,7 +76,12 @@ export default {
|
|||||||
const currentStr = current.format('YYYY-MM-DD')
|
const currentStr = current.format('YYYY-MM-DD')
|
||||||
if (!this.checkedValue.includes(currentStr)) {
|
if (!this.checkedValue.includes(currentStr)) {
|
||||||
console.log('加日期')
|
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 {
|
} else {
|
||||||
console.log('减日期')
|
console.log('减日期')
|
||||||
this.checkedValue = this.checkedValue.filter(item => item !== currentStr)
|
this.checkedValue = this.checkedValue.filter(item => item !== currentStr)
|
||||||
|
|||||||
Reference in New Issue
Block a user