Vue.nextTick
lastmod 2021-07-10created 2021-07-102 edits
How to use $nextTick in Vue.
About
If you wrap code with $nextTick and manipulate the DOM through a callback, Vue.js finally executes the function in $nextTick after it has finished updating the data and the UI.
created: function() {
// ...
this.$nextTick(function() {
var dom = document.getElementById('item-0');
dom.style.backgroundColor = 'red';
});
}