So I'm looping through my allItems Array of Objects and I want to show something when a certain button is clicked.
allItems
allItems = [
{
title: 'test',
show: false,
description: 'this is test'
},
{
title: 'test 1',
show: false,
description: 'the test 1'
}
]
List.vue
v-col cols="3" v-for="item in allItems" :key="item.id">
<v-card width="100%">
<v-card-text>
<span class="text--primary">
<span class="title">{{ item.title.substring(0,28)+".." }}</span>
</span>
</v-card-text>
<v-card-actions>
<v-btn icon @click="item.show = !item.show">
<v-icon>{{ item.show ? 'mdi-menu-up' : 'mdi-menu-down' }}</v-icon>
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-if="item.show">
<span class="pt-10">{{ item.description }}</span>
</div>
</v-expand-transition>
</v-card>
</v-col>
My problem is when the button is getting clicked its not opening the description.
EDIT
It looks like I didn't put much info. I'm using Vuex to handle my state.
PS: I'm not passing the computed value anymore to the child component.
in my List.vue script
import { mapActions, mapGetters } from "vuex";
export default {
data: () => ({}),
methods: {
...mapActions(["fetchItems"])
},
created() {
this.fetchItems();
},
computed: mapGetters(["allItems"])
};
allItems? Is is inside component's data method?props: ['allItems']