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

img tag in lazy-compoent will not update when data change #412

Closed
peng opened this issue Dec 24, 2019 · 3 comments
Closed

img tag in lazy-compoent will not update when data change #412

peng opened this issue Dec 24, 2019 · 3 comments

Comments

@peng
Copy link
Contributor

peng commented Dec 24, 2019

https://codesandbox.io/embed/loving-star-7knj0?fontsize=14&hidenavigation=1&theme=dark
In this example when change data, first img tag src attributes will not update.
In my project all img tag in lazy-component will not update when data change

@precogtyrant
Copy link

I have the same issue. Did you find a resolution?

@hilongjw
Copy link
Owner

@peng Hi, I updated this code example, you can take a look: https://codesandbox.io/s/practical-banach-fgzgh

The point is that you need to use the :key="uniq" with lazy-component

// can't update
<div v-for="(item,index) in list" :key="index" >
      <lazy-component>
        <img  :src="item.src" :key="item.src" >
      </lazy-component>
    </div>
// working fine now
<div v-for="(item,index) in list" :key="index" >
      <lazy-component :key="item.src" >
        <img  :src="item.src" :key="item.src" >
      </lazy-component>
    </div>

@peng
Copy link
Contributor Author

peng commented Dec 29, 2019

@hilongjw Oh it works. Good ! Thanks !
@precogtyrant Auther answer the resolution !

peng added a commit to peng/vue-lazyload that referenced this issue Dec 31, 2019
hilongjw added a commit that referenced this issue Jan 2, 2020
docs: Add lazy-component docs for #412
@peng peng closed this as completed Jan 4, 2020
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

3 participants