A
A
alienwave2020-08-16 12:27:43
JavaScript
alienwave, 2020-08-16 12:27:43

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

1 answer(s)
A
Aetae, 2020-08-16
@alienwave

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 question

Ask a Question

731 491 924 answers to any question