Skip to content

Instantly share code, notes, and snippets.

@ederchrono
Created May 15, 2019 06:44
Show Gist options
  • Save ederchrono/d347be6aea51edae9785469a97ee00df to your computer and use it in GitHub Desktop.
Save ederchrono/d347be6aea51edae9785469a97ee00df to your computer and use it in GitHub Desktop.
// after our data inside the Vue instance
computed: {
currentImage () {
return images[this.currentImageIndex]
},
previousImageIndex () {
return (this.currentImageIndex - 1 + images.length) % images.length
},
previousImage () {
return images[this.previousImageIndex]
},
nextImageIndex () {
return (this.currentImageIndex+1) % images.length
},
nextImage () {
return images[this.nextImageIndex]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment