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

pull/7517/head
24min 7 months ago committed by GitHub
parent ed27700ef4
commit 42d33e963c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -372,7 +372,7 @@ export default {
} }
}, },
slideHandler(index, dontAnimate = false) { slideHandler(index, dontAnimate = false) {
const { asNavFor, currentSlide, beforeChange, speed, afterChange } = this.$props; const { asNavFor, beforeChange, speed, afterChange } = this.$props;
const { state, nextState } = slideHandler({ const { state, nextState } = slideHandler({
index, index,
...this.$props, ...this.$props,
@ -381,7 +381,7 @@ export default {
useCSS: this.useCSS && !dontAnimate, useCSS: this.useCSS && !dontAnimate,
}); });
if (!state) return; if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide); beforeChange && beforeChange(this.currentSlide, state.currentSlide);
const slidesToLoad = state.lazyLoadedList.filter( const slidesToLoad = state.lazyLoadedList.filter(
value => this.lazyLoadedList.indexOf(value) < 0, value => this.lazyLoadedList.indexOf(value) < 0,
); );
@ -390,7 +390,7 @@ export default {
} }
if (!this.$props.waitForAnimate && this.animationEndCallback) { if (!this.$props.waitForAnimate && this.animationEndCallback) {
clearTimeout(this.animationEndCallback); clearTimeout(this.animationEndCallback);
afterChange && afterChange(currentSlide); afterChange && afterChange(this.currentSlide);
delete this.animationEndCallback; delete this.animationEndCallback;
} }
this.setState(state, () => { this.setState(state, () => {

Loading…
Cancel
Save