mirror of https://github.com/ElemeFE/element
DatePicker: daterange 在手动 input 输入后, defaultTime 没有生效
parent
c64358a8f1
commit
469c9af971
|
@ -86,7 +86,7 @@
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Clickoutside from 'element-ui/src/utils/clickoutside';
|
import Clickoutside from 'element-ui/src/utils/clickoutside';
|
||||||
import { formatDate, parseDate, isDateObject, getWeekNumber } from 'element-ui/src/utils/date-util';
|
import { formatDate, parseDate, isDateObject, getWeekNumber, modifyWithTimeString } from 'element-ui/src/utils/date-util';
|
||||||
import Popper from 'element-ui/src/utils/vue-popper';
|
import Popper from 'element-ui/src/utils/vue-popper';
|
||||||
import Emitter from 'element-ui/src/mixins/emitter';
|
import Emitter from 'element-ui/src/mixins/emitter';
|
||||||
import ElInput from 'element-ui/packages/input';
|
import ElInput from 'element-ui/packages/input';
|
||||||
|
@ -671,7 +671,8 @@ export default {
|
||||||
const value = this.parseString(this.userInput && this.userInput[0]);
|
const value = this.parseString(this.userInput && this.userInput[0]);
|
||||||
if (value) {
|
if (value) {
|
||||||
this.userInput = [this.formatToString(value), this.displayValue[1]];
|
this.userInput = [this.formatToString(value), this.displayValue[1]];
|
||||||
const newValue = [value, this.picker.value && this.picker.value[1]];
|
const [startTime, endTime] = this.defaultTime || [];
|
||||||
|
const newValue = [modifyWithTimeString(value, startTime), this.picker.value && modifyWithTimeString(this.picker.value[1], endTime)];
|
||||||
this.picker.value = newValue;
|
this.picker.value = newValue;
|
||||||
if (this.isValidValue(newValue)) {
|
if (this.isValidValue(newValue)) {
|
||||||
this.emitInput(newValue);
|
this.emitInput(newValue);
|
||||||
|
@ -684,7 +685,8 @@ export default {
|
||||||
const value = this.parseString(this.userInput && this.userInput[1]);
|
const value = this.parseString(this.userInput && this.userInput[1]);
|
||||||
if (value) {
|
if (value) {
|
||||||
this.userInput = [this.displayValue[0], this.formatToString(value)];
|
this.userInput = [this.displayValue[0], this.formatToString(value)];
|
||||||
const newValue = [this.picker.value && this.picker.value[0], value];
|
const [startTime, endTime] = this.defaultTime || [];
|
||||||
|
const newValue = [this.picker.value && modifyWithTimeString(this.picker.value[0], startTime), modifyWithTimeString(value, endTime)];
|
||||||
this.picker.value = newValue;
|
this.picker.value = newValue;
|
||||||
if (this.isValidValue(newValue)) {
|
if (this.isValidValue(newValue)) {
|
||||||
this.emitInput(newValue);
|
this.emitInput(newValue);
|
||||||
|
|
Loading…
Reference in New Issue