[Vuejs]-Strange behavior of editable component re-ordering

0👍

Solved as @Fabio suggested by adding an id for all cells data, then using it as a key in v-for.

Before:

<th v-for="(column, index_col) in columns" :key="index_col">

After:

<th v-for="(column, index_col) in columns" :key="column.id">

My data before (simplified):

['cell text 1', 'cell text 2']

My data now:

[{'id': '123123', 'text': 'cell text 1'}, {'id': '34353453', 'text': 'cell text 2'}]

It seems related: Why not always use the index as the key in a vue.js for loop?

Leave a comment