update TimePicker

update TimePicker
This commit is contained in:
梁灏 2016-12-27 15:15:29 +08:00
parent 2d94873892
commit 603e437bc2
3 changed files with 12 additions and 87 deletions

View file

@ -58,17 +58,17 @@
if (!newVal) return;
newVal = new Date(newVal);
if (!isNaN(newVal)) {
this.date = newVal;
this.handleChange({
hours: newVal.getHours(),
minutes: newVal.getMinutes(),
seconds: newVal.getSeconds()
});
// this.$nextTick(() => this.scrollTop());
}, false);
}
}
},
methods: {
handleChange (date) {
handleChange (date, emit = true) {
if (date.hours !== undefined) {
this.date.setHours(date.hours);
this.hours = this.date.getHours();
@ -81,6 +81,7 @@
this.date.setSeconds(date.seconds);
this.seconds = this.date.getSeconds();
}
if (emit) this.$emit('on-pick', this.date, true);
}
}
};