C
C
Cyrus2019-06-13 13:23:15
Vue.js
Cyrus, 2019-06-13 13:23:15

On the button to display the data of different arrays in the component?

5d02238ea72af482943498.png
What is the best way to organize? v-if or slot or even spread across different files because there are many arrays in one place?
Sandbox here: https://codepen.io/kirillz-the-styleful/pen/NZWOEd

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2019-06-13
@storm184

Add a property - an array that will contain your "different arrays". Add property - index of displayed array. Add a computed property - a displayable array. Render elements based on rendered array data.
https://jsfiddle.net/w0vrxcyg/1/

R
Robur, 2019-06-13
@Robur

I understand the elements are the same.
Store the data in a store (vuex for example), make a getter there to get the current list depending on which button was clicked, and in the component simply display the current list from the store.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question