Commit 3fe9acf2 authored by wacky6.AriesMBP's avatar wacky6.AriesMBP Committed by 杨奕

DatePicker: supports default value

default-value sets a default value when picker opens
parent 2cc0fe63
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment