[update 87527] 日期多选组件,去掉输入的错误格式

This commit is contained in:
danshihao
2024-08-06 16:59:00 +08:00
parent d5bf43054d
commit 3d61f84276
+2 -1
View File
@@ -101,7 +101,8 @@ export default {
const oldVal = this.checkedValue.join(',')
if (newVal !== oldVal) {
if (newVal) {
this.checkedValue = [...new Set(newVal.split(','))]
// 去重、去掉格式不对的
this.checkedValue = [...new Set(newVal.split(','))].filter(dateStr => dateStr && /^\d{4}-\d{2}-\d{2}$/.test(dateStr))
} else {
this.checkedValue = []
}