From 531cd1654b42b89bd35efdbd15a9d2d3bf8d6036 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Tue, 7 Mar 2017 18:06:56 +0800 Subject: [PATCH] support DatePicker & TimePicker --- CHANGE.md | 5 +++-- README.md | 6 +++--- examples/app.vue | 1 + examples/main.js | 4 ++++ examples/routers/date.vue | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- src/components/date-picker/base/confirm.vue | 4 ++-- src/components/date-picker/base/date-table.vue | 2 +- src/components/date-picker/base/month-table.vue | 2 +- src/components/date-picker/base/time-spinner.vue | 20 ++++++++++---------- src/components/date-picker/base/year-table.vue | 2 +- src/components/date-picker/panel/date-range.vue | 12 ++++++------ src/components/date-picker/panel/date.vue | 8 ++++---- src/components/date-picker/panel/time-range.vue | 6 +++--- src/components/date-picker/panel/time.vue | 4 ++-- src/components/date-picker/picker.vue | 64 ++++++++++++++++++++++++++++++++++++++-------------------------- src/components/date-picker/picker/date-picker.js | 6 +++--- src/components/date-picker/picker/time-picker.js | 6 +++--- src/components/input/input.vue | 6 +++++- src/index.js | 8 ++++---- 19 files changed, 265 insertions(+), 79 deletions(-) diff --git a/CHANGE.md b/CHANGE.md index ebf1cac..eb4c71f 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,7 +1,7 @@ ### Button 可以考虑是否支持 @click,而不用 @click.native ### Input -使用 v-model +使用 v-model,增加 on-input-change // todo 考虑更名 ### RadioGroup 使用 v-model ### Radio @@ -44,4 +44,5 @@ Caspanel 的 sublist 从 prop -> data ### Select model 改为 value,支持 v-model ### Page -class 改为 className \ No newline at end of file +class 改为 className +### DatePicker diff --git a/README.md b/README.md index 942732d..2824bc3 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ - [ ] Table - [x] Select - [x] Slider -- [ ] DatePicker -- [ ] TimePicker +- [x] DatePicker +- [x] TimePicker - [x] Cascader -- [ ] Transfer +- [x] Transfer - [x] InputNumber - [x] Rate - [x] Upload diff --git a/examples/app.vue b/examples/app.vue index 3e790f6..9d30575 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -47,6 +47,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; }
  • Backtop
  • Page
  • Transfer
  • +
  • Date
  • diff --git a/examples/main.js b/examples/main.js index 99accb3..c77659b 100644 --- a/examples/main.js +++ b/examples/main.js @@ -152,6 +152,10 @@ const router = new VueRouter({ { path: '/transfer', component: require('./routers/transfer.vue') + }, + { + path: '/date', + component: require('./routers/date.vue') } ] }); diff --git a/examples/routers/date.vue b/examples/routers/date.vue index ab2476f..4d1751c 100644 --- a/examples/routers/date.vue +++ b/examples/routers/date.vue @@ -1,14 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/date-picker/base/confirm.vue b/src/components/date-picker/base/confirm.vue index 551174c..00f1e44 100644 --- a/src/components/date-picker/base/confirm.vue +++ b/src/components/date-picker/base/confirm.vue @@ -4,8 +4,8 @@ - {{ t('i.datepicker.clear') }} - {{ t('i.datepicker.ok') }} + {{ t('i.datepicker.clear') }} + {{ t('i.datepicker.ok') }} diff --git a/src/components/date-picker/picker/date-picker.js b/src/components/date-picker/picker/date-picker.js index 8e0a33c..c6b67da 100644 --- a/src/components/date-picker/picker/date-picker.js +++ b/src/components/date-picker/picker/date-picker.js @@ -23,11 +23,11 @@ export default { value: {} }, created () { - if (!this.value) { + if (!this.currentValue) { if (this.type === 'daterange' || this.type === 'datetimerange') { - this.value = ['','']; + this.currentValue = ['','']; } else { - this.value = ''; + this.currentValue = ''; } } diff --git a/src/components/date-picker/picker/time-picker.js b/src/components/date-picker/picker/time-picker.js index b0f77c0..7925596 100644 --- a/src/components/date-picker/picker/time-picker.js +++ b/src/components/date-picker/picker/time-picker.js @@ -24,11 +24,11 @@ export default { value: {} }, created () { - if (!this.value) { + if (!this.currentValue) { if (this.type === 'timerange') { - this.value = ['','']; + this.currentValue = ['','']; } else { - this.value = ''; + this.currentValue = ''; } } this.panel = getPanel(this.type); diff --git a/src/components/input/input.vue b/src/components/input/input.vue index eb87d80..33982e2 100644 --- a/src/components/input/input.vue +++ b/src/components/input/input.vue @@ -19,7 +19,8 @@ @keyup.enter="handleEnter" @focus="handleFocus" @blur="handleBlur" - @input="handleInput"> + @input="handleInput" + @change="handleChange">