D
D
Darkness2019-09-02 12:01:12
Vue.js
Darkness, 2019-09-02 12:01:12

How to transfer the necessary data depending on the router?

How to correctly implement the data in such a situation. On the screen: There can be many such dice. Now this is an array of state and everything looks nice, there may be more or less of them. The problem is that you can click on each plate and go, say, to the project (that is, each plate has data inside )
The transition was made by id:

router-link(:to="`/project/${project.id}`" :project="project"  v-for="project in item.projects" :key="project.title")

Now, when clicking on a plate, each has its own route = project /: id
Question : How can I better/correctly transfer data, for example, so that when clicking, only the data of this plate is shown (as an ID) ?
Screen :
5d6cd9bc3002e654772682.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-09-02
@AntonBrock

Take the data to vuex, forward the route parameter to the component, make a calculated property in the component, where you will get the desired object from the storage by id.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question