From 373dfb3cad8fcffcea3c71b6b67f9575f1e1f511 Mon Sep 17 00:00:00 2001 From: Rijn Date: Mon, 16 Jan 2017 18:10:31 -0600 Subject: [PATCH] removed observer --- src/components/carousel/carousel-item.vue | 7 ++++--- src/components/carousel/carousel.vue | 23 +++++++---------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/components/carousel/carousel-item.vue b/src/components/carousel/carousel-item.vue index 929ffb0d..e60a50e7 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 b4ce57e3..28855459 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 () {