ismail9k / vue3-carousel

Vue 3 carousel component
https://ismail9k.github.io/vue3-carousel/
MIT License
653 stars 162 forks source link

TypeError: Cannot set properties of null (setting 'index') #348

Closed Tsuev closed 6 months ago

Tsuev commented 6 months ago

https://github.com/ismail9k/vue3-carousel/blob/11a2105b42f107cdfd0880c355ea49892c5c4160/src/components/Carousel.ts#L426

Because of this line of code, I can't use the component individually and not inside a loop v-for. You can see from the code that this code does nothing. Please remove this in the new update.

Example code

<Carousel>
  <Slide>Any element</Slide>
  <Slide>Any element</Slide>
</Carousel>
Tsuev commented 6 months ago

I solved the problem. Just added props index...

<Carousel>
  <Slide :index="1">Any element</Slide>
  <Slide :index="2">Any element</Slide>
</Carousel>