Vue: children component not update when change Array props in parent

Created on 4 Jun 2018  路  2Comments  路  Source: vuejs/vue

Version

2.5.16

Reproduction link

https://jsfiddle.net/jesse_y/obbL7s1k/

Steps to reproduce

  1. click change, children component not update
  2. click update, children component update

What is expected?

click change, children component update

What is actually happening?

children component not update


maybe not a bug, I test 2.* and 1.*(not all), it not work in those version.
is it a bug? if not why?
thanks for your time.

Most helpful comment

this.numbers[0]++

is equal to

this.numbers[0] = this.numbers[0] + 1

which is already discussed in the guide.

You should do this instead:

this.$set(this.numbers, 0, this.numbers[0] + 1)

All 2 comments

this.numbers[0]++

is equal to

this.numbers[0] = this.numbers[0] + 1

which is already discussed in the guide.

You should do this instead:

this.$set(this.numbers, 0, this.numbers[0] + 1)

@Justineo thanks!

Was this page helpful?
0 / 5 - 0 ratings