Subscribe on changes!

An interesting question about setup syntax sugar

avatar
Mar 7th 2023

Vue version

3.2.47

Link to minimal reproduction

https://sfc.vuejs.org/#eNp9Uk2P0zAQ/StDLmmlxu4GuJRstXwcEAcuCxfkQ91ktg3UY8t2ilCU/864gd2S0j1Eybz3/N54Mn321jlx7DBbZVWofesiBIydWytqjbM+Qg8eH2CAB28N5CzNFdWWQgQPt4mbLeeKFB0wQs3IzV+60VFz3QNpgyt+1238tYL8HbafWtrl7Dk8WpntmXTz/vPHTSIVcTNfWoO2i7PZHG7X0CsCkBJa0x10xAac3iF0jtMwUV4c9aFDditTmZoQyVWkdEbz+z3SN374Gqw22xPLxObr/YdNwtIl+OywgHK5XM7fKKrkOBoeChcRjUvRXAFUL4qCB1HvNXEbRTGC+5t1z3ODYagkfz8J+Zpkr6iZm+rrC2mZpPUoLJ+Ep1lfcz6RU+vJYK4ePNNcdqepGd3/ezy1CRf5lXwcYLbIxiUrjHbie7DEa3j6weoPEVTGm5OQhPHypVpl+xhdWEnZkfuxE7U18o456TuKvCxFY83dS1GKV69l04Z4jgsMpth6+zOg50SVLc7MJYNH9IVHatCjfzZsov0ncMJdhKZMXu8hG34Dx4oiOw==

Steps to reproduce

When the ref object r changes, the component regenerates the virtual dom for update. Why is c of type number updated, but objects rmb and data are not updated, but data.name.city is updated. 当ref对象r改变时,组件重新生成虚拟dom进行更新,为什么number类型的c更新了,而对象rmb和data没有更新,但是data.name.city却更新了呢.

And if you put the c and data objects of type number into one element, the data will be updated again! 如果把 number类型的c和data对象放到一个元素中,那么data又会更新了

What is expected?

I don't understand,how is sugar designed for this part

What is actually happening?

always

System Info

No response

Any additional comments?

No response