Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after change data #242

Open
minoo221 opened this issue Apr 27, 2022 · 0 comments
Open

Error after change data #242

minoo221 opened this issue Apr 27, 2022 · 0 comments

Comments

@minoo221
Copy link

Hi I have a problem with vue-slick-carouse in my Nuxt project. I have two carousel in one component:

<vue-slick-carousel
@swipe="setCarouselSwiping(true)"
@mouseup.native="setCarouselSwiping(false)"
@touchend.native="setCarouselSwiping(false)"
@afterChange="onCarouselChange"
v-bind="glassesCarouselVideo"
:asNavFor="$refs.carousel"
ref="carouselVideo"
:key="swiperKey"
>
<div
   class="slide"
   v-for="carouselProduct in productsCasted"
   :key="carouselProduct.id"
   v-if="productImage(carouselProduct)"
   ></div>
</vue-slick-carousel>
</div>
<vue-slick-carousel
@swipe="setCarouselSwiping(true)"
@mouseup.native="setCarouselSwiping(false)"
@touchend.native="setCarouselSwiping(false)"
@afterChange="onCarouselChange"
v-bind="glassesCarousel"
ref="carousel"
:asNavFor="$refs.carouselVideo"
:key="swiperKey"
>
<div
   class="glasses"
   v-for="(carouselProduct, index) in productsCasted"
   :key="carouselProduct.id"
   v-if="productImage(carouselProduct)"
   >
   <div
      @click="openProduct(carouselProduct, index)"
      class="glasses__wrapper"
      :class="{ '--active': product && carouselProduct.id == product.id }"
      >
      <div @click="refreshFittingbox()" v-if="fittingboxInitialized">
         <ImageResource :src="productImage(carouselProduct)" />
      </div>
      <NuxtLink
         :to="productRoute(product, selectedProduct)"
         target="_self"
         v-if="!isLCDDisplay && product && carouselProduct.id == product.id"
         >
         <div class="more-info">{{ _('viac o produkte') }}</div>
      </NuxtLink>
   </div>
</div>
</vue-slick-carousel>

Both slick carousel using asNavFor property. When I change data length after filter then slick carousel return error after change slide:

Uncaught TypeError: Cannot read properties of undefined (reading 'goTo')
I try after change data length add this method:

this.$nextTick(() => {
    this.swiperKey++;
});

but nothing happened. Please help me. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant