F
F
fessracha2019-09-05 15:53:56
JavaScript
fessracha, 2019-09-05 15:53:56

How can you save the state of a dynamic component?

There is a page with the output of goods, a basket, etc.
Each product I have is a component - product-item and is displayed in a loop.
I need to be able to work with the state of each component, but the problem is that they are dynamic.
Tell me in what form you can store the state of each product-item in the vuex store

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Ololoshchenko, 2019-09-18
@veremii

If you need to keep it straight all the time then vuex.
If I were you, I would do it differently. For each component in the form of props, I gave it an object of type
Data(){
return {
items: [
{id: 123,
price:123
}]
}
}
Inside this object, play with the data as you like. They belong to the parent and in the event of the destruction of the child, they will not be lost.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question