Skip to content

Commit

Permalink
Close #602 Add month and year change events
Browse files Browse the repository at this point in the history
  • Loading branch information
jtommy committed Feb 20, 2018
1 parent 8e135e9 commit 78e00ae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@

* **Add nuxt-buefy on docs**, [see here](https://buefy.github.io/#/documentation/start) (thanks @anteriovieira)
* #581 Add ``is-row-checkable`` prop to table (thanks @jvmonjo)
* #602 Add ``changeMonth`` and ``changeYear`` events to datepicker
* #609 Add ``is-full-page`` prop to loading, to limit it to its container (thanks @adrlen)
* #610 Add ``visible`` prop to tabItem

Expand Down
17 changes: 17 additions & 0 deletions docs/pages/components/datepicker/api/datepicker.js
Expand Up @@ -162,6 +162,23 @@ export default [
description: 'Footer',
props: '—'
}
],
events: [
{
name: '<code>input</code>',
description: 'Triggers when value is changed',
parameters: '<code>value: Date</code>'
},
{
name: '<code>changeMonth</code>',
description: 'Triggers when calendar month is changed',
parameters: '<code>month: Number(0-11)</code>'
},
{
name: '<code>changeYear</code>',
description: 'Triggers when calendar year is changed',
parameters: '<code>year: Number</code>'
}
]
}
]
10 changes: 10 additions & 0 deletions src/components/datepicker/Datepicker.vue
Expand Up @@ -339,6 +339,16 @@
this.dateSelected = value
!this.isValid && this.$refs.input.checkHtml5Validity()
},
/*
* Emit input event on month and/or year change
*/
'focusedDateData.month'(value) {
this.$emit('changeMonth', value)
},
'focusedDateData.year'(value) {
this.$emit('changeYear', value)
}
},
methods: {
Expand Down

0 comments on commit 78e00ae

Please sign in to comment.