There is an array of apps with links, and a Dialog component that has v-model="dialog" to close it. However, after adding v-model to the v-dialog, the functionality of the apps is affected. The current app is passed as a prop to Dialog, but it always sends the last app in the apps array. I'm unsure where I've gone wrong.
Parent component
<v-col v-for="app in apps" :key="app._id" :cols="setBreakpointCols">
<v-card class="pa-2 " outlined height="230px">
<v-dialog v-model="dialog">
<template v-slot:activator="{ on: dialog, attrs }">
<v-tooltip right color="#363636" max-width="250px">
<template v-slot:activator="{ on: tooltip }">
<v-img :src="getImgUrl(app.src)" class="white--text align-end"
gradient="to bottom, rgba(0,0,0,.5), rgba(0,0,0,.5)" height="85%" v-bind="attrs"
v-on="{ ...tooltip, ...dialog }">
<v-card-title v-text="app.title"></v-card-title>
</v-img>
</template>
<span v-if="app.vpnRequired">VPN needed to run!</span>
<v-divider class="my-1" v-if="app.vpnRequired" dark ></v-divider>
<span>{{ app.description }}</span>
</v-tooltip>
<h1>{{app.link}}</h1>
</template>
<h1>{{app.link}}</h1>
<Dialog @closeDialog="closeDialog" :app="app" />
</v-dialog>
<v-card-actions mb-2>
<v-spacer></v-spacer>
<v-tooltip top color="#363636">
<template v-slot:activator="{ on, attrs }" v-if="app.quickActions">
<v-btn @click="DeleteAppFromQuickActions(app)" icon>
<v-icon v-bind="attrs" v-on="on" >
mdi-minus-box-outline
</v-icon>
</v-btn>
</template>
<template v-slot:activator="{ on, attrs }" v-else>
<v-btn @click="AddAppToQuickActions(app)" icon>
<v-icon v-bind="attrs" v-on="on">
mdi-plus-box-outline
</v-icon>
</v-btn>
</template>
<span v-if="app.quickActions">Delete from QuickActions</span>
<span v-else>Add to QuickActions</span>
</v-tooltip>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
</v-col>
Child component
<template>
<v-container fluid>
<v-row>
<v-col fixed style="background:#363636;" class="d-flex justify-end" cols="12">
<v-btn plain color="grey" :href="app.link" target="_blank">
<v-icon>mdi-open-in-new</v-icon>
</v-btn>
<v-btn @click="closeDialog" plain color="grey">
<v-icon>mdi-close-box-outline</v-icon>
</v-btn>
</v-col>
<v-col cols="12">
<iframe :src="app.link" width="100%" height="800px"
frameborder="0">
</iframe>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
name: "Dialog",
props: ['app'],
data() {
return {
}
},
methods: {
closeDialog: function (){
this.$emit('closeDialog')
}
}
}
</script>