Subscribe on changes!

a problem with the order of ref DOM after onUpdated

avatar
Jan 12th 2021

Version

3.0.5

Reproduction link

https://codesandbox.io/s/ref-dom-s6s3f?file=/src/App.vue

Steps to reproduce

点击列表

Click the list in view

What is expected?

视图中dom顺序和打印的dom顺序应该相同

The updated DOM order is the same as that printed by console

What is actually happening?

打印结果总是上一次dom

The result of printing is always the last dom

avatar
Jan 12th 2021

The template refs are set in the order of patching, not in the order of the DOM structure. For your demo, you can use an object instead of an array to achieve the goal: https://codesandbox.io/s/ref-dom-forked-p493e?file=/src/App.vue

avatar
Jan 12th 2021

@HcySunYang thanks