C
C
chumak_pro2019-08-30 16:00:16
Vue.js
chumak_pro, 2019-08-30 16:00:16

What is the right way to implement this in vue?

I am writing a small component.
Slider, on each slide there is a block and a button that shows it.
The number of blocks is always different - sometimes 5, sometimes 10, sometimes 14.
I do the display of the block through a variable.
How to initialize them if I don't know exactly how many there will be, or is it just not done this way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-08-30
@UPSA

Or a complex array (in theory):
Slide1{block1{},block2{},...},Slide2{block1{},block2{},...},Slide3{block1{},block2{},.. },...
v-for iterate over blocks, but there will be a double v-for.
Or slide as a separate component (template may be the same for everyone, which is bad). For each Slide (Component) a separate array with a description of the blocks and dynamic loading of the components, those clicked on the "Button" of another template.
PS

the button that shows it
I hope not bottom )))
Do a v-on:click on the div

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question