Changing an item of an array directly by its index triggers a view responsiveness

This issue has been tracked since 2022-08-25.

Version

2.7.8

Reproduction link

jsfiddle.net

Steps to reproduce

<template>
   <div id="app">
        {{a[0]}} {{b[0].b}}
  </div>
</template>

data: {
   a:["hello"],
   b:[{"b":"world"}]
},
mounted() {
  this.a[0] = "world"
  this.b[0].b ="hello"

}

What is expected?

hello hello

What is actually happening?

world hello

LinusBorg wrote this answer on 2022-08-25

aassigning to this.b[0].b triggers a re-render of the component template. In that re-render, the latest data will be used for all content, so this behavior is totally normal.

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-10-03
Star Count 199758
Watcher Count 6095
Fork Count 32874
Issue Count 590

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date