Answer the question
In order to leave comments, you need to log in
How to tell Vue that the DOM has been updated?
The bottom line is that I created a directive that is needed to hide / reveal a block, a smooth change in height. When you hang it on an element, it creates a div wrapper and transfers all elements from the block to this wrapper, everything works, everything is fine, BUT there is one problem. Vue does not know anything about the existence of this wrapper and problems begin if, for example, dynamically adding an element to an array that is inferred using v-for. Vue simply ignores the blocks created in pure JS and the mess begins.
const HiddenWrapper = document.createElement('div');
const ChildNodes = el.children;
for (const el of [...ChildNodes]) {
HiddenWrapper.insertAdjacentElement('beforeend', el);
}
Answer the question
In order to leave comments, you need to log in
6 hours without answers and comments)))
1) where did you create the directive? In outside the Vue project or in Vue components?
2) First, let's say everything is terrible, then it seems to me that watch will help you.
if, for example, you dynamically add an element to an array that is output using v-for. Vue simply ignores the blocks created in pure JS and the mess begins.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question