From 699a9dc8dda85aef19a94836d85b7a98113a1a8c Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Tue, 20 Dec 2016 09:35:23 +0800 Subject: [PATCH] update DatePicker --- src/components/date-picker/picker.vue | 10 ++++++++-- test/routers/date.vue | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/date-picker/picker.vue b/src/components/date-picker/picker.vue index cad1726..61b29e9 100644 --- a/src/components/date-picker/picker.vue +++ b/src/components/date-picker/picker.vue @@ -269,9 +269,9 @@ if (parsedValue[0].getTime() > parsedValue[1].getTime()) { correctValue = oldValue; } else { - // todo 判断disabledDate correctValue = formatter(parsedValue, format); } + // todo 判断disabledDate } else { correctValue = oldValue; } @@ -345,7 +345,13 @@ this.picker.resetView && this.picker.resetView(); }, emitChange (date) { - this.$emit('on-change', formatDate(date, this.format || DEFAULT_FORMATS[this.type])); + const format = this.format || DEFAULT_FORMATS[type]; + const formatter = ( + TYPE_VALUE_RESOLVER_MAP[this.type] || + TYPE_VALUE_RESOLVER_MAP['default'] + ).formatter; + + this.$emit('on-change', formatter(date, format)); } }, watch: { diff --git a/test/routers/date.vue b/test/routers/date.vue index 7e7d2fc..80552b7 100644 --- a/test/routers/date.vue +++ b/test/routers/date.vue @@ -135,7 +135,7 @@ computed: {}, methods: { change (date) { -// console.log(date) + console.log(date) }, change2 (s) { // console.log(s) -- libgit2 0.21.4