M
M
mrSeller2018-04-10 18:54:53
Vue.js
mrSeller, 2018-04-10 18:54:53

How to count the number of elements in VueJS?

There is a slider that works through a scroll, and for it to work adequately, I need to get all elements with the body__screen class, but, to my surprise, document.getElementsByClassName()it just doesn’t work inside vue scripts!
I googled, googled, looked through the documentation and did not master it.
They suggested methods that simply do not work, or are suitable for a single element (the ref attribute).
How then to receive the necessary elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2018-04-11
@kulakoff Vue.js

Why doesn't it work?) javascript hasn't gone anywhere, just like the browser api.
You can use querySelectorAll as well:document.querySelectorAll('.body__screen')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question