Skip to content

Commit

Permalink
#310 fix(event): adding kebab-case public events (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
darraghenright authored and quinnlangille committed Mar 21, 2019
1 parent c7a3a1f commit 649b9b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -102,7 +102,7 @@ export default {
| `navigation-click` | | Carousel | Emits when the a navigation button is clicked, with the current direction (`backward` or `forward`) |
| `pagination-click` | | Carousel | Emits when a pagination button is clicked, with the current `pageNumber` |
| `page-change` | Number | Carousel | Emits with the current page number. |
| `slide-click` | Object | Slide | Emits with the *dataset* object of the selected element ··
| `slide-click` | Object | Slide | Emits with the *dataset* object of the selected element ··
| `transition-start` | | Carousel | Emits when the transition end is reached |
| `transition-end` | | Carousel | Emits when the transition start is reached · |

Expand Down
2 changes: 2 additions & 0 deletions docs/source/api/index.md
Expand Up @@ -322,3 +322,5 @@ Emits when a pagination button is clicked, with the current `pageNumber`

* **Type**: `Number`
* **Emitter**: `Carousel`

> Lowercase versions of the above events are also emitted, namely—`pagechange`, `slideclick`, `transitionstart` and `transitionend`.
11 changes: 2 additions & 9 deletions play/index.js
Expand Up @@ -249,6 +249,7 @@ play("Carousel", module)
}
})
.add("With local event on pageChange", {
.add("pageChange event", {
template:
`<div style="width: 100%; display: flex; justify-content: center; margin-top: 40px;">
<carousel style="width: 500px;" @pageChange="onPageChange">
Expand Down Expand Up @@ -381,6 +382,7 @@ play("Carousel", module)
template:
`<div style="width: 100%; display: flex; justify-content: center; margin-top: 40px;">
<carousel style="width: 500px;" :navigateTo="navigateTo" :scrollPerPage=false v-on:pagechange="pageChanged">
<carousel style="width: 500px;" :navigateTo="newSlide" :scrollPerPage=false v-on:pagechange="pageChanged">
<slide v-for="slide in slides" :key="slide.src">
<img style="width: 100%;" :src= slide />
</slide>
Expand All @@ -402,15 +404,6 @@ play("Carousel", module)
slides: images
}
},
computed: {
navigateTo() {
if (this.newSlideAnimation)
return this.newSlide

else
return [this.newSlide, false]
}
},
methods: {
gotoSlide(val, animation) {
this.newSlideAnimation = (animation === false ? false : true);
Expand Down

0 comments on commit 649b9b2

Please sign in to comment.