update TimePicker
update TimePicker
This commit is contained in:
parent
d609ba8682
commit
0dd7b94a4d
3 changed files with 32 additions and 29 deletions
|
@ -85,9 +85,8 @@
|
|||
},
|
||||
watch: {
|
||||
value (newVal) {
|
||||
if (!newVal) {
|
||||
return;
|
||||
} else if (Array.isArray(newVal)) {
|
||||
if (!newVal) return;
|
||||
if (Array.isArray(newVal)) {
|
||||
const valStart = newVal[0] ? toDate(newVal[0]) : false;
|
||||
const valEnd = newVal[1] ? toDate(newVal[1]) : false;
|
||||
|
||||
|
|
|
@ -444,15 +444,18 @@
|
|||
immediate: true,
|
||||
handler (val) {
|
||||
const type = this.type;
|
||||
if ((type === 'time' || type === 'timerange') && !(val instanceof Date)) {
|
||||
const parser = (
|
||||
TYPE_VALUE_RESOLVER_MAP[type] ||
|
||||
TYPE_VALUE_RESOLVER_MAP['default']
|
||||
).parser;
|
||||
if (type === 'timerange') val = val.join(RANGE_SEPARATOR);
|
||||
const parser = (
|
||||
TYPE_VALUE_RESOLVER_MAP[type] ||
|
||||
TYPE_VALUE_RESOLVER_MAP['default']
|
||||
).parser;
|
||||
|
||||
if (type === 'time' && !(val instanceof Date)) {
|
||||
val = parser(val, this.format || DEFAULT_FORMATS[type]);
|
||||
} else if (type === 'timerange' && Array.isArray(val) && val.length === 2 && !(val[0] instanceof Date) && !(val[1] instanceof Date)) {
|
||||
val = val.join(RANGE_SEPARATOR);
|
||||
val = parser(val, this.format || DEFAULT_FORMATS[type]);
|
||||
}
|
||||
|
||||
this.internalValue = val;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue