[Vuejs]-Html list doesn't display the items correctly in sorted order when a new element gets added to the list array in vue 3

0👍

If your array is updated when you inspect it, but the display is the old version without the new added item it’s because you have a binding issue.

You can solve it with different way the most easier is to use the property Vue.set().

Vue.set(array, index, newItem)
// Inside a vue instance you can do this.$set()

The second way, and maybe good for you is to try to save the binding:

 const cars = computed(()=>{
    return carStore.get_cars.sort((a,b)=> b.value - a.value)
 })

Leave a comment