Skip to content

Commit

Permalink
fix: carousel beforeChange current value not correct (#7419)
Browse files Browse the repository at this point in the history
  • Loading branch information
24min authored Apr 22, 2024
1 parent ed27700 commit 42d33e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/vc-slick/inner-slider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export default {
}
},
slideHandler(index, dontAnimate = false) {
const { asNavFor, currentSlide, beforeChange, speed, afterChange } = this.$props;
const { asNavFor, beforeChange, speed, afterChange } = this.$props;
const { state, nextState } = slideHandler({
index,
...this.$props,
Expand All @@ -381,7 +381,7 @@ export default {
useCSS: this.useCSS && !dontAnimate,
});
if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide);
beforeChange && beforeChange(this.currentSlide, state.currentSlide);
const slidesToLoad = state.lazyLoadedList.filter(
value => this.lazyLoadedList.indexOf(value) < 0,
);
Expand All @@ -390,7 +390,7 @@ export default {
}
if (!this.$props.waitForAnimate && this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
afterChange && afterChange(currentSlide);
afterChange && afterChange(this.currentSlide);
delete this.animationEndCallback;
}
this.setState(state, () => {
Expand Down

0 comments on commit 42d33e9

Please sign in to comment.