Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138337

Vue JS V-For component reactivity

$
0
0

I have an issue where I can't get a child component to update when new data is passed to it. The data is passing OK but the component doesn't update.

If I change the :key to the object rather than a unique ID it works! But I get a warning error not to use the object as the key, so obviously that is not the way to go?!

<swiper ref="timelineCarousel" :options="swiperOption">
        <div slot="pagination" class="swiper-pagination kt-margin-b-10"></div>

        <!-- creates swiper slides for each timeline -->
        <swiper-slide
          v-for="timeline in timelines"
          :key="timeline.id + timeline.time"
          class="col-md-3 noSwipe">
          <!-- creates the timeline draggable elements -->
          <timeline
            :id="timeline.id"
            :key="timeline.id + timeline.current_vehicle_reg"
            :hour-to-scroll-to="scrollHour"
            :day-to-scroll-to="scrollDay"
            :month-to-scroll-to="scrollMonth"
            :year-to-scroll-to="scrollYear"></timeline>
        </swiper-slide>
      </swiper>

So when I update this.timeline I can see the data changing in the vue toolsnbut the component doesn't update - unless I use the timeline object as the key!!

I have no idea what I am doing wrong.


Viewing all articles
Browse latest Browse all 138337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>