Answer the question
In order to leave comments, you need to log in
How to convert document.querySelectorAll to Vue.js?
Refactoring code from pure js to Vue. There are 6 blocks with a class (let's say .block), controlled via querySelectorAll(), but it needs to be optimized for vue code. I only know about $refs, but in my opinion, hang a collective farm on each ref="" element. What is the best way to do it?
Answer the question
In order to leave comments, you need to log in
Correct answer: querySelectorAll is not modified in any way for Vue.
Forget about direct DOM work. In Vue, you work with data and only data. Changes in the data are automatically reflected in the display, but you do not touch the display with your hands at all.
If there are problems with understanding - give a more specific example, and then we will suggest a more specific solution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question