Commit 964582b3996bb2e86517196a297714d25e91ff2e

Authored by 梁灏
1 parent a18d2b3a

update TimePicker

update TimePicker
src/components/date-picker/panel/time-range.vue
@@ -144,7 +144,17 @@ @@ -144,7 +144,17 @@
144 this.dateEnd.setSeconds(dateEnd.seconds); 144 this.dateEnd.setSeconds(dateEnd.seconds);
145 this.secondsEnd = this.dateEnd.getSeconds(); 145 this.secondsEnd = this.dateEnd.getSeconds();
146 } 146 }
147 - if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true); 147 + // judge endTime > startTime?
  148 + if (this.dateEnd < this.date) {
  149 + this.$nextTick(() => {
  150 + this.dateEnd = new Date(this.date);
  151 + this.hoursEnd = this.dateEnd.getHours();
  152 + this.minutesEnd = this.dateEnd.getMinutes();
  153 + this.secondsEnd = this.dateEnd.getSeconds();
  154 + });
  155 + } else {
  156 + if (emit) this.$emit('on-pick', [this.date, this.dateEnd], true);
  157 + }
148 }, 158 },
149 handleStartChange (date) { 159 handleStartChange (date) {
150 this.handleChange(date, {}); 160 this.handleChange(date, {});
test/routers/date.vue
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 methods: { 51 methods: {
52 52
53 c (s) { 53 c (s) {
54 -// console.log(1,s); 54 + console.log(s);
55 // this.value2 = s; 55 // this.value2 = s;
56 }, 56 },
57 ok () { 57 ok () {