E
E
Elladri2019-01-17 14:40:28
JavaScript
Elladri, 2019-01-17 14:40:28

How to pass an array from one component to another in Vue?

There is a “conponents” folder where there are two components. The first component has an array that is traversed and information is displayed in the cards. There is a button on the card that adds one of the cards to favorites (that is, to another array in the same component). How can I pass an array with a favorite to another component so that it can be iterated over and output everything?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Dergachov, 2019-01-17
@Elladri

Use events.

// Генерируем событие, возможно с передаваемыми данными
this.$emit('название' [, данные]);
// Слушаем событие
this.$on('название', function(данные) {...});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question