Pass correct arguments to on-change
callback
This commit is contained in:
parent
21acf032ac
commit
57f0582b71
4 changed files with 94 additions and 5 deletions
|
@ -183,7 +183,9 @@
|
|||
return this.internalValue.slice();
|
||||
} else {
|
||||
const isRange = this.type.includes('range');
|
||||
const val = this.internalValue.map(date => date instanceof Date ? new Date(date) : (date || ''));
|
||||
let val = this.internalValue.map(date => date instanceof Date ? new Date(date) : (date || ''));
|
||||
|
||||
if (this.type.match(/^time/)) val = val.map(this.formatDate);
|
||||
return (isRange || this.multiple) ? val : val[0];
|
||||
}
|
||||
},
|
||||
|
@ -293,8 +295,8 @@
|
|||
);
|
||||
},
|
||||
emitChange () {
|
||||
this.$emit('on-change', this.visualValue, this.publicValue);
|
||||
this.$nextTick(() => {
|
||||
this.$emit('on-change', this.publicValue);
|
||||
this.dispatch('FormItem', 'on-form-change', this.publicValue);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -163,6 +163,8 @@ const RANGE_FORMATTER = function(value, format) {
|
|||
if (start && end) {
|
||||
return formatDate(start, format) + RANGE_SEPARATOR + formatDate(end, format);
|
||||
}
|
||||
} else if (!Array.isArray(value) && value instanceof Date){
|
||||
return formatDate(value, format);
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue