Version
2.5.16
Reproduction link
https://codepen.io/JJPandari/pen/gzLVBq?editors=1010
Steps to reproduce
See the codepen snippet. Follow the comment there to change the vm's data and see what happens.
What is expected?
Even if the prop already exists, using set still makes it reactive, thus trigger view update.
What is actually happening?
Using set later doesn't update the view.
Related source code:
|
* Set a property on an object. Adds the new property and |
I think most users would expect
set to make the prop reactive whenever it's used. I initially opened
an issue for the api doc because it wasn't clear (for me) about this. But the comment in the source code is.
Version
2.5.16
Reproduction link
https://codepen.io/JJPandari/pen/gzLVBq?editors=1010
Steps to reproduce
See the codepen snippet. Follow the comment there to change the vm's data and see what happens.
What is expected?
Even if the prop already exists, using
setstill makes it reactive, thus trigger view update.What is actually happening?
Using
setlater doesn't update the view.Related source code:
vue/src/core/observer/index.js
Line 192 in 3eb37ac
setto make the prop reactive whenever it's used. I initially opened an issue for the api doc because it wasn't clear (for me) about this. But the comment in the source code is.