Answer the question
In order to leave comments, you need to log in
How to output the width of each element from a list?
eat list
<div id="range" class="demo">
<span v-for="n in 10">
<span class="item">{{ n }}</span>
</span>
</div>
Answer the question
In order to leave comments, you need to log in
This can only be done after rendering.
First you need to get links to these spans in js - https://v3.ru.vuejs.org/ru/guide/migration/array-r...
Instead of outputting from one to 10, make an array of objects, with a number and a show flag and iterates over this array
Then in the loop you iterate over them and see the width
this.$refs.items[0].clientWidth , change the show flag for the corresponding array element
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question