gs-shop / vue-slick-carousel

๐ŸšฅVue Slick Carousel with True SSR Written for โšกFaster Luxstay
https://gs-shop.github.io/vue-slick-carousel/
Other
801 stars 186 forks source link

Cannot read properties of undefined (reading 'prevArrow') #214

Open ArkoxHub opened 2 years ago

ArkoxHub commented 2 years ago

I just installed this component into my project and I have this error when trying to show up the basic example of the main website

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'prevArrow') vue-slick-carousel.umd.js:10810 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'prevArrow')

Any idea whats wrong? I'm using Vue 3

GuchiRey commented 2 years ago

Me too!!! :(

Ahmedreda20 commented 2 years ago

Same issues happened with me too!! :(

aaronmorillo7 commented 2 years ago

Hello everybody! I have the same issue, I'm using Vue 3 and I would like to know how to resolve it or if it is a compatibility issue with Vue 3.

Ahmedreda20 commented 2 years ago

M

Hello everybody! I have the same issue, I'm using Vue 3 and I would like to know how to resolve it or if it is a compatibility issue with Vue 3.

Try to use nuxtjs instead of vue 2 or 3 just did that and worked as well

smarques commented 2 years ago

Same issue here, on vue 3.

shaked007 commented 2 years ago

same issue over here...

ricepower commented 2 years ago

same issue over here toooooo

fanzhengshao commented 2 years ago

same issue over here toooooo Uncaught (in promise) TypeError: Cannot read properties of null (reading 'type')

gijshoppen commented 2 years ago

saaame

Yubo0826 commented 2 years ago

same :( Any1 have solution?

thejawadali commented 2 years ago

having the same issue as well

abuzaid-sayyad commented 2 years ago

same issue

Wil-Script commented 2 years ago

same for me, i use vuejs 3. anyone have a solution?

zarpio commented 2 years ago

Same issue with laravel, vue js, inertia js

kinger251285 commented 2 years ago

Me too, Laravel 8, Jetstream, Inertia, Vue 3

jonasalberttan commented 2 years ago

same issue here...

sebastian-reynoso commented 2 years ago

same issue here after migrate :(

ayman-alshantaf commented 2 years ago

same issue here ...๐Ÿ˜‘ what is the solution to this problem??

maninak commented 2 years ago

I don't know if this is related or not, but since I've found a work-around for a similar issue with vue-slick-carousel and nuxt.js v2 here's my 2 cents:

The specific error I was getting was

TypeError: Cannot read properties of undefined (reading 'length')

image

image

I don't know why I wasn't getting it until now and which specific change in my source code started triggering it (I didn't change the lib version for sure, though), but I've been getting this error every time I would change page and the component was about to be destroyed.

I practically worked around it, by killing the component before it has a chance to crash.

// BaseSlider.vue

<template>
  <div>
    <div class="mb-6">
-       <VueSlickCarousel v-bind="vueSlickCarouselConfig" ref="sliderEl" :arrows="false">
+       <VueSlickCarousel v-if="$slots.default && $slots.default.length" v-bind="vueSlickCarouselConfig" ref="sliderEl" :arrows="false">
        <slot></slot>
      </VueSlickCarousel>
    </div>
    <div class="flex flex-row gap-3">
      <button @click="showPrev">
        <NuxtImg
          src="/img/icons/prev.svg"
          width="40"
          height="40"
          loading="lazy"
          decoding="async"
          alt="arrow pointing left"
          class="select-none"
        />
      </button>
      <button @click="showNext">
        <NuxtImg
          src="/img/icons/next.svg"
          width="40"
          height="40"
          loading="lazy"
          decoding="async"
          alt="arrow pointing right"
          class="select-none"
        />
      </button>
    </div>
  </div>
</template>

<script lang="ts">
const vueSlickCarouselConfig = {
  infinite: false,
  speed: 600,
  variableWidth: false,
  adaptiveHeight: false,
  autoplay: false,
  slidesToScroll: 1,
  swipeToSlide: true,
  slidesToShow: 3,
  responsive: [
    { breakpoint: 1280, settings: { slidesToShow: 2 } },
    { breakpoint: 640, settings: { slidesToShow: 1 } },
  ],
}

export default defineComponent({
  setup() {
    const sliderEl = ref()

    function showPrev() {
      sliderEl.value?.prev()
    }

    function showNext() {
      sliderEl.value?.next()
    }

    return { vueSlickCarouselConfig, sliderEl, showPrev, showNext }
  },
})
</script>
sarjid commented 2 years ago

TypeError: Cannot read properties of undefined (reading 'prevArrow')

Using Vue3 .. Same problem

mdhasanpatwary commented 2 years ago

Vue3, same issue here ...๐Ÿ˜‘

sarjid commented 2 years ago

Vue3, same issue here ...๐Ÿ˜‘

at least iam using this package.. it's work in vue3 poperly .. https://ismail9k.github.io/vue3-carousel/examples.html#autoplay-example

Hasnain-js commented 2 years ago

Same, ive face this issue.What can i do..?

salman3040 commented 2 years ago

same issue here ...๐Ÿ˜‘ what is the solution to this problem??

alfredthompsonOvie commented 1 year ago

is there a solution to this error Cannot read properties of undefined (reading 'prevArrow')

sarjid commented 1 year ago

hey man. Just Use swiper slider.it's very easy to use. iam using it without any problem. https://swiperjs.com/vue https://swiperjs.com/demos#space-between

sarjid commented 1 year ago

use you can use swiper slider .. it's very easy man.. https://swiperjs.com/demos#space-between

On Tue, Sep 13, 2022 at 6:44 PM alfred thompson ovie < @.***> wrote:

is there a solution to this error Cannot read properties of undefined (reading 'prevArrow')

โ€” Reply to this email directly, view it on GitHub https://github.com/gs-shop/vue-slick-carousel/issues/214#issuecomment-1245360010, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMWCZZQXU42YIHTERPI3QILV6BZKJANCNFSM5EUT6CYQ . You are receiving this because you commented.Message ID: @.***>

Rehman-Ali commented 1 year ago

same issue.

onderakbulut commented 1 year ago

same issue.

mark1282 commented 1 year ago

Same issue

Seeman13 commented 1 year ago

This is because the slot-scope construct has been removed in Vue3! In order to avoid this error, you need to replace:

settings.prevArrow = this.$scopedSlots.prevArrow
settings.nextArrow = this.$scopedSlots.nextArrow
settings.customPaging = this.$scopedSlots.customPaging

to

settings.prevArrow = this.$slots.prevArrow
settings.nextArrow = this.$slots.nextArrow
settings.customPaging = this.$slots.customPaging

in VueSlickCarousel.vue and rebuild package.

But this will not solve the problem of the slider! Since there will be another problem: "Component is missing template or render function". And the slider will simply not render! Since the package is built under Vue2 and cannot work with Vue3!

Forget about this package in Vue3! Use other alternatives!

mirjalolinomjonov commented 1 year ago

Same issues happened with me too!! :(

abdallahmaali commented 1 year ago

same issues

motahharm commented 10 months ago

I have this problem too!

JosiaAlmeida commented 7 months ago

I had this problem too, but, I solved

My dependencies: vue-slick-carousel: "^1.0.6, vue-slick-ts: "^1.1.0", nuxt: "^3.8.0", vue: "^3.3.4",

plugins/slick.ts

import { defineNuxtPlugin } from '#app'
import { ListSlickMethods, VueSlickCarousel } from "vue-slick-ts"; // 
import "vue-slick-carousel/dist/vue-slick-carousel.css";
import "vue-slick-carousel/dist/vue-slick-carousel-theme.css";
import "vue-slick-ts/dist/css/slick.css";

export default defineNuxtPlugin(nuxtApp => {
  nuxtApp.vueApp.component("VueSlickCarousel", VueSlickCarousel)
})
anurag-gautam-maersk commented 6 months ago

TypeError: Cannot read properties of undefined (reading 'prevArrow')

Using Vue3 .. Same problem

viethq-vareal commented 3 months ago

using nuxt 3 same and having the same problem

Kalips2 commented 1 month ago

Same issue! Please fix it already

saidov-arb commented 1 week ago

Same issue!