From 2996bb013877343f8c4f9f83f075a62e356fa7e1 Mon Sep 17 00:00:00 2001 From: mxie <15623530290@163.com> Date: Wed, 22 Nov 2017 17:15:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +++++--- datepicker/index.vue | 3 +-- demo/App.vue | 6 ++++++ package.json | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6c85708..0d3fdc8 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ export default { | range | Boolean | false | if true, the type is daterange or datetimerange | | confirm | Boolean | false | if true, need click the button to change the value| | format | String | yyyy-MM-dd | Date formatting string | -| lang | String | zh | Translation (en/zh/es/pt-br/fr/ru/de/it/cs) | +| lang | String | zh | Translation (en/zh/es/pt-br/fr/ru/de/it/cs) | | placeholder | String | | input placeholder text | | width | String/Number | 210 | input size | | disabled-days | Array | [] | Days in YYYY-MM-DD format to disable | @@ -76,5 +76,7 @@ export default { | start | Date | Start Date | | end | Date | End Date | - - +## Events +| Name | Description | Callback Arguments | +|-----------------|------------------------------|------------------------| +| confirm | When you click 'OK' button | the currentValue | diff --git a/datepicker/index.vue b/datepicker/index.vue index 3c6db2e..2f9f948 100644 --- a/datepicker/index.vue +++ b/datepicker/index.vue @@ -161,13 +161,12 @@ export default { const val = this.currentValue if ((!this.range && val) || (this.range && val[0] && val[1])) { this.$emit('input', val) - console.log(this.value, this.currentValue) } }, confirmDate () { this.updateDate() this.closePopup() - this.$emit('confirm') + this.$emit('confirm', this.currentValue) }, selectDate () { if (!this.confirm) { diff --git a/demo/App.vue b/demo/App.vue index 3aa3dc1..6a4eb25 100644 --- a/demo/App.vue +++ b/demo/App.vue @@ -54,6 +54,7 @@ range lang="en" format="yyyy-MM-dd" + @confirm="confirm" confirm>
@@ -85,6 +86,11 @@ export default { demo2: '\n\n', demo3: '\n\n' } + }, + methods: { + confirm (val) { + console.log(val) + } } } diff --git a/package.json b/package.json index c1755e7..4d76e47 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vue2-datepicker", "description": "A Datepicker Component For Vue2", "main": "datepicker/index.vue", - "version": "1.6.1", + "version": "1.6.2", "scripts": { "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"