hilongjw / vue-lazyload

A Vue.js plugin for lazyload your Image or Component in your application.
http://hilongjw.github.io/vue-lazyload/
MIT License
8.01k stars 868 forks source link

How does v-lazy-container rewrite image path form Vuex store data? #276

Open MatsumotoHiroko opened 6 years ago

MatsumotoHiroko commented 6 years ago

I've developed a modal. This modal was called the main page. The modal shows images using Vue lazy load. Vuex gives the modal an image path. Unfortunately, when this modal was called again, the one drew the previous image.

Please let me know if you have a hint for renewing image path on v-lazy-container.

Thank you.

Modal.vue

<template>
  <modal>
    <ul>
      <li v-for="(eva, index) in getImageUrls(obj)" :key="index">
        <div v-lazy-container="{ selector: 'img' }" width="90" height="90">
          <img :data-src="eva" :data-error="images.none" :data-loading="images.loading" class="img-thumbnail">
        </div>
      </li>
    </ul>
  </modal>
</template>

<script>
  import { mapGetters } from 'vuex'
  ....
  computed: {
      ...mapGetters({
          obj: '$_projet/obj',
        })
    }
  }
</script>       
lexygon commented 6 years ago

i got same problem on a different situation

lexygon commented 6 years ago

@MatsumotoHiroko regarding to #273 using a key in for loop fixes the problem. thanks to google translate :)