Vue-carousel: Question: How can I add manual slide controls?

Created on 15 Jul 2018  路  5Comments  路  Source: SSENSE/vue-carousel

Is there a way to have a manual control like buttons?
Then, I want to jump on page 3 for example?

Thanks.

question

Most helpful comment

Could the carousel's methods be added to the api documentation?

All 5 comments

@gomezmark you should define ref attribute on the carousel
<carousel ref="carousel"></carousel>
and use goToPage function
this.$refs.carousel.goToPage(3)

Also you can get previous, next, current page or perPage
const perPage = this.$refs.carousel.perPage
const current = this.$refs.carousel.currentPage
const previous = this.$refs.carousel.getPreviousPage()
const next = this.$refs.carousel.getNextPage()

Yeah @dvasyliev is right! There is actually an example of adding "go to page x" buttons on the vue-play instance when you spin up the dev server :~)

@dvasyliev

Thank you for you answer.
but the .getNextPage() is not working on my end.
It returns the next page index.

But what I did is like this.

slideControl (action) {
      let page = 0
      if (action === 'next') {
        page = this.$refs.carousel.getNextPage()
      } else {
        page = this.$refs.carousel.getPreviousPage()
      }
      this.$refs.carousel.goToPage(page)
    }

Could the carousel's methods be added to the api documentation?

Getting this error this.$refs.carousel.getPreviousPage is not a function

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manniL picture manniL  路  3Comments

power-cut picture power-cut  路  5Comments

lggwettmann picture lggwettmann  路  5Comments

ranasl62 picture ranasl62  路  3Comments

rizqirizqi picture rizqirizqi  路  5Comments