Vue array subscript update cannot update view

In

vue, updating an array with subscripts is not successful and needs to be updated using the set method, but updating a specific variable in the array with a subscript is an updatable
this.list [0] = {mes:10} / / cannot update the view
this.list [0]. Mes = 10mp / can be updated
this is why

Oct.09,2021
The properties in the

object are listenable; some methods of the array are overridden, but the subscript of the array cannot listen


change the objects in the array, which is not responsive in vue . If you want to respond on the view, use Vue.set () or vm.$set () (vm is the instance name).
take yours as an example:

this.$set(this.list,0,{mes:10});//

vue set


let obj = {mes:10}
this.list.splice


official website
ide/list.html-sharp%E6%95%B0%E7%BB%84%E6%9B%B4%E6%96%B0%E6%A3%80%E6%B5%8B" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

clipboard.png
you can take a look at the " blog post . The official interpretation says that due to the limitation of javaScript, it can actually be done, but it is not cost-effective in performance

.
Menu