According to Vue documentation:
Vue is unable to detect certain changes made to an array, such as:
- Directly setting an item using the index, for example
vm.items[indexOfItem] = newValue
- Modifying the length of the array, like
vm.items.length = newLength
However, there is no mention of how Vue handles spread operators
.
If we use this.arr1 = [...arr2, ...arr3];
to assign values to arr1
, which is initialized in data({})
, will Vue be able to detect this change?
While spread operators
can simplify tasks, are they considered safe for modifying arrays in this scenario?