Browse Source

fix: carousel beforeChange current value not correct (#7419)

pull/7517/head
24min 7 months ago committed by GitHub
parent
commit
42d33e963c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      components/vc-slick/inner-slider.jsx

6
components/vc-slick/inner-slider.jsx

@ -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,
@ -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,
);
@ -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, () => {

Loading…
Cancel
Save