vue icon indicating copy to clipboard operation
vue copied to clipboard

v-for not reusing existing elements

Open ereveniaud opened this issue 2 years ago • 3 comments

Version

2.7.14

Reproduction link

codepen.io

Steps to reproduce

  • Focus an input in the list
  • Scroll up, the input still has the focus (row reused)
  • Scroll down, the input loose the focus (row rendered)

What is expected?

Elements should not be re-rendered when scrolling down (same behavior as scroll up)

What is actually happening?

When scrolling up, only new elements are rendered. When scrolling up, all elements are rendered


Work as expected in Vue 3 (codepen: https://codepen.io/thel-rico/pen/mdjqVZJ)

ereveniaud avatar Jan 18 '23 18:01 ereveniaud

unfortunately, this is also a problem for me @ereveniaud maybe you found a workaround?

v-bilyavskiy avatar Dec 22 '23 07:12 v-bilyavskiy

This is because when scrolling down, vue updates the child nodes by comparing the first one with the next one, so each vnode will be updated.

LeiDeMing avatar Apr 25 '24 07:04 LeiDeMing

👀

klmhyeonwoo avatar Jun 30 '24 15:06 klmhyeonwoo