From 42d33e963cb6bcf3203b9772a8c885dd6cb91309 Mon Sep 17 00:00:00 2001 From: 24min Date: Mon, 22 Apr 2024 10:18:19 +0800 Subject: [PATCH] fix: carousel beforeChange current value not correct (#7419) --- components/vc-slick/inner-slider.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/vc-slick/inner-slider.jsx b/components/vc-slick/inner-slider.jsx index a166d39cb..380b2112d 100644 --- a/components/vc-slick/inner-slider.jsx +++ b/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, () => {