Feature request: emit event when currentPage changes
See original GitHub issuerelated: #25
I want to handle navigation from outside the Carousel. I am using Vuex, so it would be handy to have an event emitted when the currentPage changes. I could do it, add a watcher on currentPage that emits an event, and create a pull request, if you want.
I tried this, but it does not work, would be nice though:
watch: {
'$refs.carousel.currentPage' () {
if (this.currentPage !== this.$refs.carousel.currentPage) {
store.dispatch('carousel/currentPageChanged', this.$refs.carousel.currentPage)
}
}
}
The rest should work like this (did not test):
computed: {
...mapGetters('carousel', [
'currentPage'
])
},
watch: {
currentPage () {
if (this.currentPage !== this.$refs.carousel.currentPage) {
this.$refs.carousel.goToPage(this.currentPage)
}
}
}
Thank you!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[Paginator] Does not emit event when changed ...
Assigning to .pageIndex does not emit a page event. There is no method to jump to a specified page and ensure that an...
Read more >Detect changes on the url - javascript
There is no "clean", event-based way to detect such URL changes from a ... emit a DOM event that can be listened to...
Read more >Page Lifecycle API - Chrome Developers
The Page Lifecycle API brings app lifecycle features common on mobile ... Note: a focus event does not necessarily signal a state change....
Read more >Window: popstate event - Web APIs | MDN
The popstate event of the Window interface is fired when the active history entry changes while the user navigates the session history.
Read more >Feature requests | Optimizely Developer Community
Request new features in Optimizely products; everything from user interface to API changes. Note: This forum is closed for submissions, please visit Optimizely ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
I didn’t find out how to use this “Event on page changed” feature properly. Through Vuex $store then ? . Am I wrong or is this not documented yet ? Can you please provide a very quick example, for example an implementation of a listener to that event ? That is just the little last thing I need.
Thanks.
I merged in your change and released it under 0.6.4. Your contribution is appreciated! 🥇