Commit 964582b3996bb2e86517196a297714d25e91ff2e

Authored by 梁灏
1 parent a18d2b3a

update TimePicker

update TimePicker
src/components/date-picker/panel/time-range.vue
... ... @@ -144,7 +144,17 @@
144 144 this.dateEnd.setSeconds(dateEnd.seconds);
145 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 159 handleStartChange (date) {
150 160 this.handleChange(date, {});
... ...
test/routers/date.vue
... ... @@ -51,7 +51,7 @@
51 51 methods: {
52 52  
53 53 c (s) {
54   -// console.log(1,s);
  54 + console.log(s);
55 55 // this.value2 = s;
56 56 },
57 57 ok () {
... ...