mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Swipe): incorrect active swipe when children changed #7802
This commit is contained in:
parent
1a34a6599b
commit
51cb389ef9
@ -258,7 +258,7 @@ export default createComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const resize = () => {
|
const resize = () => {
|
||||||
initialize(activeIndicator.value);
|
initialize(state.active);
|
||||||
};
|
};
|
||||||
|
|
||||||
let touchStartTime;
|
let touchStartTime;
|
||||||
@ -377,9 +377,14 @@ export default createComponent({
|
|||||||
|
|
||||||
linkChildren({ size, props, count, activeIndicator });
|
linkChildren({ size, props, count, activeIndicator });
|
||||||
|
|
||||||
watch([() => children.length, () => props.initialSwipe], () => {
|
watch(() => props.initialSwipe, initialize);
|
||||||
initialize();
|
watch(
|
||||||
});
|
() => children.length,
|
||||||
|
() => {
|
||||||
|
const active = Math.min(children.length - 1, state.active);
|
||||||
|
initialize(active);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.autoplay,
|
() => props.autoplay,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user