Skip to content
Advertisement

How to handle V-show dynamically

I am trying to build an Ecommerce shopping website. I import data from JSON file and by using v-for loop I am able to print data. There is one section in each order that is Show Order Details option, after clicking it one more section called order details will show. I used v-show tag to open the details section. But when I am clicking one show order details option in every three orders show details part is opening, it’s not taking the ID properly in v-show. I tried with v-bind, but that doesn’t work. Please help me.

MyOrders.vue

JavaScript

MyOrder.js

JavaScript

Advertisement

Answer

You can use item.id instead of boolean to toggle details :

JavaScript
JavaScript
Advertisement