【update】多选时间组件 增加全部删除的方法-测试1
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
:ref="fieldName"
|
||||
:dropdownClassName="'j-multiple-date-picker ' + fieldName + '-drop'"
|
||||
@openChange="handleOpenChange"
|
||||
@change="handleChange"
|
||||
style="width: 100%"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
@@ -35,6 +36,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
value (val) {
|
||||
console.log(val, '----watch--value-------')
|
||||
if (!val) {
|
||||
this.checkedValue = []
|
||||
document.getElementById(this.fieldName).children[0].children[0].value = ''
|
||||
@@ -79,12 +81,32 @@ export default {
|
||||
}, 100)
|
||||
})
|
||||
} else {
|
||||
const newVal = document.getElementsByClassName(this.fieldName + '-drop')[0].children[0].children[0].children[0].children[0].children[0].value
|
||||
const oldVal = this.checkedValue.join(',')
|
||||
if (newVal !== oldVal) {
|
||||
if (newVal) {
|
||||
this.checkedValue = newVal.split(',')
|
||||
} else {
|
||||
this.checkedValue = []
|
||||
}
|
||||
this.$emit('change', this.checkedValue.join(','))
|
||||
}
|
||||
this.$refs[this.fieldName].blur()
|
||||
this.open = open
|
||||
this.$nextTick(() => {
|
||||
// console.log('------this.checkedValue.join(\',\')----------', this.checkedValue.join(','))
|
||||
// this.$emit('change', lastCheckedValue.join(','))
|
||||
document.getElementById(this.fieldName).children[0].children[0].value = this.checkedValue.join(',')
|
||||
})
|
||||
}
|
||||
},
|
||||
handleChange (val) {
|
||||
console.log('-handleChange-----', val)
|
||||
if (!val) {
|
||||
this.checkedValue = []
|
||||
this.$emit('change', this.checkedValue.join(','))
|
||||
}
|
||||
},
|
||||
getCurrentStyle (current) {
|
||||
const currentStr = current.format('YYYY-MM-DD')
|
||||
if (this.checkedValue.includes(currentStr)) {
|
||||
|
||||
Reference in New Issue
Block a user