Commit 344131a7af7e70a30eba662aea0f77cb03d8d21e
1 parent
e1874103
update DatePicker
update DatePicker
Showing
4 changed files
with
10 additions
and
4 deletions
Show diff stats
src/components/date-picker/base/year-table.vue
src/components/date-picker/panel/date.vue
src/components/date-picker/picker.vue
| ... | ... | @@ -269,6 +269,8 @@ |
| 269 | 269 | this.visualValue = correctValue; |
| 270 | 270 | event.target.value = correctValue; |
| 271 | 271 | this.internalValue = correctDate; |
| 272 | + | |
| 273 | + if (correctValue !== oldValue) this.emitChange(correctDate); | |
| 272 | 274 | }, |
| 273 | 275 | handleInputMouseenter () { |
| 274 | 276 | if (this.readonly || this.disabled) return; |
| ... | ... | @@ -298,7 +300,7 @@ |
| 298 | 300 | } |
| 299 | 301 | |
| 300 | 302 | this.picker.$on('on-pick', (date, visible = false) => { |
| 301 | - this.$emit('on-change', formatDate(date, this.format || DEFAULT_FORMATS[this.type])); | |
| 303 | + this.emitChange(date); | |
| 302 | 304 | this.value = date; |
| 303 | 305 | this.visible = visible; |
| 304 | 306 | this.picker.value = date; |
| ... | ... | @@ -313,6 +315,9 @@ |
| 313 | 315 | this.picker.value = this.internalValue; |
| 314 | 316 | } |
| 315 | 317 | this.picker.resetView && this.picker.resetView(); |
| 318 | + }, | |
| 319 | + emitChange (date) { | |
| 320 | + this.$emit('on-change', formatDate(date, this.format || DEFAULT_FORMATS[this.type])); | |
| 316 | 321 | } |
| 317 | 322 | }, |
| 318 | 323 | watch: { | ... | ... |
test/routers/date.vue
| ... | ... | @@ -33,13 +33,13 @@ |
| 33 | 33 | // return time && time.valueOf() < Date.now(); |
| 34 | 34 | } |
| 35 | 35 | }, |
| 36 | - format: 'yyyy/MM/dd' | |
| 36 | + format: 'yyyy年MM月dd日' | |
| 37 | 37 | } |
| 38 | 38 | }, |
| 39 | 39 | computed: {}, |
| 40 | 40 | methods: { |
| 41 | 41 | change (date) { |
| 42 | -// console.log(date) | |
| 42 | + console.log(date) | |
| 43 | 43 | }, |
| 44 | 44 | change2 (s) { |
| 45 | 45 | // console.log(s) | ... | ... |