Skip to content

Commit 5208b1a

Browse files
committed
fix(vue): update virtual slides on nextTick
Fixes #4172
1 parent 19a645d commit 5208b1a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/vue/swiper.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, ref, onMounted, onUpdated, onBeforeUnmount, watch } from 'vue';
1+
import { h, ref, onMounted, onUpdated, onBeforeUnmount, watch, nextTick } from 'vue';
22
import { getParams } from './get-params';
33
import { initSwiper, mountSwiper } from './init-swiper';
44
import { needsScrollbar, needsNavigation, needsPagination, uniqueClasses, extend } from './utils';
@@ -300,12 +300,11 @@ const Swiper = {
300300
});
301301

302302
// update on virtual update
303-
watch(
304-
() => virtualData,
305-
() => {
303+
watch(virtualData, () => {
304+
nextTick(() => {
306305
updateOnVirtualData(swiperRef.value);
307-
},
308-
);
306+
});
307+
});
309308

310309
// mount swiper
311310
onMounted(() => {

0 commit comments

Comments
 (0)