diff --git a/src/components/carousel/carousel-item.vue b/src/components/carousel/carousel-item.vue index 929ffb0..e60a50e 100644 --- a/src/components/carousel/carousel-item.vue +++ b/src/components/carousel/carousel-item.vue @@ -23,9 +23,10 @@ } }, compiled () { - // this.$parent.slotChange(); - // this.$parent.updateSlides(true, true); - // this.$parent.updatePos(); + this.$parent.slotChange(); + }, + beforeDestroy () { + this.$parent.slotChange(); } }; diff --git a/src/components/carousel/carousel.vue b/src/components/carousel/carousel.vue index b4ce57e..2885545 100644 --- a/src/components/carousel/carousel.vue +++ b/src/components/carousel/carousel.vue @@ -137,8 +137,13 @@ }, // use when slot changed slotChange () { - this.slides = []; - this.slideInstances = []; + this.$nextTick(() => { + this.slides = []; + this.slideInstances = []; + + this.updateSlides(true, true); + this.updatePos(); + }); }, handleResize () { this.$nextTick(() => { @@ -167,20 +172,6 @@ }, compiled () { this.updateSlides(true); - - // watch slot changed - if (MutationObserver) { - this.observer = new MutationObserver(() => { - this.slotChange(); - this.updateSlides(true, true); - }); - - this.observer.observe(this.$els.slides, { - childList: true, - characterData: true, - subtree: true - }); - } }, watch: { autoplay () { -- libgit2 0.21.4