mirror of https://github.com/ElemeFE/element
DatePicker: supports default value
default-value sets a default value when picker openspull/4417/head^2
parent
2cc0fe6343
commit
3fe9acf294
|
@ -187,7 +187,7 @@
|
|||
|
||||
methods: {
|
||||
handleClear() {
|
||||
this.date = new Date();
|
||||
this.date = this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date();
|
||||
this.$emit('pick');
|
||||
},
|
||||
|
||||
|
@ -357,7 +357,7 @@
|
|||
return {
|
||||
popperClass: '',
|
||||
pickerWidth: 0,
|
||||
date: new Date(),
|
||||
date: this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date(),
|
||||
value: '',
|
||||
showTime: false,
|
||||
selectionMode: 'day',
|
||||
|
|
|
@ -205,6 +205,7 @@ export default {
|
|||
default: 'left'
|
||||
},
|
||||
value: {},
|
||||
defaultValue: {},
|
||||
rangeSeparator: {
|
||||
default: ' - '
|
||||
},
|
||||
|
@ -410,7 +411,7 @@ export default {
|
|||
showPicker() {
|
||||
if (this.$isServer) return;
|
||||
if (!this.picker) {
|
||||
this.panel.defaultValue = this.currentValue;
|
||||
this.panel.defaultValue = this.defaultValue || this.currentValue;
|
||||
this.picker = new Vue(this.panel).$mount();
|
||||
this.picker.popperClass = this.popperClass;
|
||||
this.popperElm = this.picker.$el;
|
||||
|
|
Loading…
Reference in New Issue