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: {
|
methods: {
|
||||||
handleClear() {
|
handleClear() {
|
||||||
this.date = new Date();
|
this.date = this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date();
|
||||||
this.$emit('pick');
|
this.$emit('pick');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@
|
||||||
return {
|
return {
|
||||||
popperClass: '',
|
popperClass: '',
|
||||||
pickerWidth: 0,
|
pickerWidth: 0,
|
||||||
date: new Date(),
|
date: this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date(),
|
||||||
value: '',
|
value: '',
|
||||||
showTime: false,
|
showTime: false,
|
||||||
selectionMode: 'day',
|
selectionMode: 'day',
|
||||||
|
|
|
@ -205,6 +205,7 @@ export default {
|
||||||
default: 'left'
|
default: 'left'
|
||||||
},
|
},
|
||||||
value: {},
|
value: {},
|
||||||
|
defaultValue: {},
|
||||||
rangeSeparator: {
|
rangeSeparator: {
|
||||||
default: ' - '
|
default: ' - '
|
||||||
},
|
},
|
||||||
|
@ -410,7 +411,7 @@ export default {
|
||||||
showPicker() {
|
showPicker() {
|
||||||
if (this.$isServer) return;
|
if (this.$isServer) return;
|
||||||
if (!this.picker) {
|
if (!this.picker) {
|
||||||
this.panel.defaultValue = this.currentValue;
|
this.panel.defaultValue = this.defaultValue || this.currentValue;
|
||||||
this.picker = new Vue(this.panel).$mount();
|
this.picker = new Vue(this.panel).$mount();
|
||||||
this.picker.popperClass = this.popperClass;
|
this.picker.popperClass = this.popperClass;
|
||||||
this.popperElm = this.picker.$el;
|
this.popperElm = this.picker.$el;
|
||||||
|
|
Loading…
Reference in New Issue