Vue · Middle · Question 10 of 75
When does a watcher with flush: 'post' run?
- ✓Correct answer: After Vue has updated the DOM, so the callback sees the new DOM
- 2Before the component is created
- 3Only when the component is unmounted
Explanation
By default watcher callbacks run before the component's DOM update. flush: 'post' (or watchPostEffect) is for reading layout; flush: 'sync' runs immediately on every change and should be rare.