mirror of https://github.com/ElemeFE/element
DatePicker: picker interaction (#6090)
* DatePicker: fix picker interaction * DatePicker: fix picker interaction * fix * DatePicker: fix picker interactionpull/6325/head
parent
7a84a3e44a
commit
5d097a0a4a
|
@ -81,6 +81,11 @@
|
||||||
|
|
||||||
selectableRange(val) {
|
selectableRange(val) {
|
||||||
this.$refs.spinner.selectableRange = val;
|
this.$refs.spinner.selectableRange = val;
|
||||||
|
},
|
||||||
|
|
||||||
|
date(val) {
|
||||||
|
this.currentDate = val;
|
||||||
|
this.reinitDate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -157,13 +162,17 @@
|
||||||
const index = list.indexOf(this.selectionRange[0]);
|
const index = list.indexOf(this.selectionRange[0]);
|
||||||
const next = (index + step + list.length) % list.length;
|
const next = (index + step + list.length) % list.length;
|
||||||
this.$refs.spinner.emitSelectRange(mapping[next]);
|
this.$refs.spinner.emitSelectRange(mapping[next]);
|
||||||
|
},
|
||||||
|
|
||||||
|
reinitDate() {
|
||||||
|
this.hours = this.currentDate.getHours();
|
||||||
|
this.minutes = this.currentDate.getMinutes();
|
||||||
|
this.seconds = this.currentDate.getSeconds();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.hours = this.currentDate.getHours();
|
this.reinitDate();
|
||||||
this.minutes = this.currentDate.getMinutes();
|
|
||||||
this.seconds = this.currentDate.getSeconds();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -34,6 +34,7 @@ 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 Focus from 'element-ui/src/mixins/focus';
|
import Focus from 'element-ui/src/mixins/focus';
|
||||||
import ElInput from 'element-ui/packages/input';
|
import ElInput from 'element-ui/packages/input';
|
||||||
|
import merge from 'element-ui/src/utils/merge';
|
||||||
|
|
||||||
const NewPopper = {
|
const NewPopper = {
|
||||||
props: {
|
props: {
|
||||||
|
@ -449,8 +450,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mountPicker() {
|
mountPicker() {
|
||||||
this.panel.defaultValue = this.defaultValue || this.currentValue;
|
const defaultValue = this.defaultValue || this.currentValue;
|
||||||
this.picker = new Vue(this.panel).$mount();
|
const panel = merge({}, this.panel, { defaultValue });
|
||||||
|
this.picker = new Vue(panel).$mount();
|
||||||
this.picker.popperClass = this.popperClass;
|
this.picker.popperClass = this.popperClass;
|
||||||
this.popperElm = this.picker.$el;
|
this.popperElm = this.picker.$el;
|
||||||
this.picker.width = this.reference.getBoundingClientRect().width;
|
this.picker.width = this.reference.getBoundingClientRect().width;
|
||||||
|
|
Loading…
Reference in New Issue