When you see nextTick, do you think of $nextTick?
This error is exactly what needs to be solved by using $nextTick
Vue executes asynchronously when updating the DOM. As long as it detects data changes, Vue will open a queue and buffer all data changes that occur in the same event loop. That is to say, assigning a value to Vue does not take effect immediately, but updates when the next event is triggered . Wait for Vue to finish updating the DOM after the data changes, you can use Vue.nextTick(callback) immediately after the data changes
$nextTick is to execute the delayed callback after the next DOM update cycle ends, use $nextTick after modifying the data, you can get the updated DOM in the callback