update TimePicker
update TimePicker
This commit is contained in:
parent
456877a165
commit
d609ba8682
2 changed files with 5 additions and 5 deletions
|
@ -417,7 +417,6 @@
|
||||||
|
|
||||||
let newDate = formatter(date, format);
|
let newDate = formatter(date, format);
|
||||||
if (type === 'daterange' || type === 'timerange') {
|
if (type === 'daterange' || type === 'timerange') {
|
||||||
console.log(newDate);
|
|
||||||
newDate = [newDate.split(RANGE_SEPARATOR)[0], newDate.split(RANGE_SEPARATOR)[1]];
|
newDate = [newDate.split(RANGE_SEPARATOR)[0], newDate.split(RANGE_SEPARATOR)[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,12 +444,13 @@
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler (val) {
|
handler (val) {
|
||||||
const type = this.type;
|
const type = this.type;
|
||||||
if (type === 'time' || type === 'timerange') {
|
if ((type === 'time' || type === 'timerange') && !(val instanceof Date)) {
|
||||||
const parser = (
|
const parser = (
|
||||||
TYPE_VALUE_RESOLVER_MAP[type] ||
|
TYPE_VALUE_RESOLVER_MAP[type] ||
|
||||||
TYPE_VALUE_RESOLVER_MAP['default']
|
TYPE_VALUE_RESOLVER_MAP['default']
|
||||||
).parser;
|
).parser;
|
||||||
if (type === 'timerange') val = val.join(RANGE_SEPARATOR);
|
if (type === 'timerange') val = val.join(RANGE_SEPARATOR);
|
||||||
|
|
||||||
val = parser(val, this.format || DEFAULT_FORMATS[type]);
|
val = parser(val, this.format || DEFAULT_FORMATS[type]);
|
||||||
}
|
}
|
||||||
this.internalValue = val;
|
this.internalValue = val;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<template>
|
<template>
|
||||||
<row>
|
<row>
|
||||||
<i-col span="12">
|
<i-col span="12">
|
||||||
<!--<date-picker type="date" placeholder="选择日期" style="width: 200px" @on-ok="ok" confirm @on-clear="clear"></date-picker>-->
|
<date-picker type="date" placeholder="选择日期" style="width: 200px" @on-ok="ok" confirm @on-clear="clear"></date-picker>
|
||||||
</i-col>
|
</i-col>
|
||||||
<i-col span="12">
|
<i-col span="12">
|
||||||
<date-picker :value="value3" type="daterange" placement="bottom-start" placeholder="选择日期" style="width: 200px"></date-picker>
|
<date-picker :value="value3" type="daterange" placement="bottom-start" placeholder="选择日期" style="width: 200px"></date-picker>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
// value: '2016-12-12 03:03:03'
|
// value: '2016-12-12 03:03:03',
|
||||||
value: '15:12:01',
|
value: '15:12:01',
|
||||||
value2: ['08:40:00', '09:40:00'],
|
value2: ['08:40:00', '09:40:00'],
|
||||||
// value2: [new Date(), new Date()],
|
// value2: [new Date(), new Date()],
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
methods: {
|
methods: {
|
||||||
c (s) {
|
c (s) {
|
||||||
console.log(1,s);
|
console.log(1,s);
|
||||||
this.value = s;
|
this.value2 = s;
|
||||||
},
|
},
|
||||||
ok () {
|
ok () {
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
|
|
Loading…
Add table
Reference in a new issue