Skip to content

Commit

Permalink
Fix state of disabling buttons when slide
Browse files Browse the repository at this point in the history
  • Loading branch information
Dual-Ice committed May 11, 2020
1 parent f45ec3c commit 200dc0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/reviews/reviews-content.pug
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ script(type="text/x-template" id="reviews-content")
ref="carousel"
:pagination-enabled="false"
:per-page-custom="[[320, 1], [577, 2]]"
@page-change="updateBtns"
).revies-slider__list
slide(
v-for="review in reviews"
Expand Down
9 changes: 6 additions & 3 deletions src/scripts/reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ new Vue({
} else {
this.$refs.carousel.goToPage(this.$refs.carousel.getPreviousPage());
}

this.nextBtnDisable = !this.$refs.carousel.canAdvanceForward
this.prevBtnDisable = !this.$refs.carousel.canAdvanceBackward
this.updateBtns()
},

makeArrWithRequireImages(array) {
Expand All @@ -83,6 +81,11 @@ new Vue({
item.photo = requirePic;
return item;
});
},

updateBtns () {
this.nextBtnDisable = !this.$refs.carousel.canAdvanceForward
this.prevBtnDisable = !this.$refs.carousel.canAdvanceBackward
}
}

Expand Down

0 comments on commit 200dc0f

Please sign in to comment.