Vue 2.0 v-for responsive key, index and item.id parameters cause differences in v-bind:key value

Reference for this article: https://www.cnblogs.com/tim100/p/7262963.html

in conclusion:

When we use v-for for rendering, we try to use the id of the rendering element's own attribute to bind a key value to the rendered element, so that when the DOM structure of the currently rendered element changes, we can respond to the element independently without triggering Rendering of all elements.

which is:

items: [
    {
        id: 2,
    },
    {
        id: 1,
    },
    {
        id: 3,
    },
    {
        id: 4,
    },
]

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324899716&siteId=291194637