• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How to change status of one component inside v-for without affecting other component

Resolved: How to change status of one component inside v-for without affecting other component

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a childComponent which is rendered dynamically via v-for inside of the parentComponent. Inside the Parent component I have some logic that fetches data from the database and displays it on the screen. The fetch request query is bases on the child component selected (clicked on). Once the user has clicked on a component I would like to show the user that the data is loading by changing text inside the child component to loading. The issue I’m facing is that when the request has been sent, all children components generated by v-for change status to “Loading…”. I would only like the once that has been clicked to change.
Edit: Added CodeSandbox
I created a simple representation of my problem.
parentComponent.vue
childComponent.vue

Answer:

try to pass index as loading prop instead of boolean:


If you have better answer, please add a comment about this, thank you!

javascript vue.js vuejs2
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Reshape tensors of unknown shape with tf.function

26/03/2023

Resolved: Use Svelte Component as Slot

26/03/2023

Resolved: Vaadin 14.9 – Redirect on Session Destroy Event

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.