Ich versuche BootstrapVue - Modal in V-for-Schleife zu verwenden und das einzige Problem ist mit modalen Direktive (v-b-modal.modal1) auf einer modalen Schaltfläche. modal1 sollte der Name der Modal-ID sein und da ich eine Schleife verwende, überlasse ich den Index in modal, zum Beispiel modal + index, aber ich weiß nicht, wie man die buttons-Anweisung in vb-modal-modal1 ändert ... vb- modal-modal5.Wie verwende ich BootstrapVue - Modal innerhalb der v-for-Schleife?
Dies ist modal Komponente
<template>
<div>
//This v-b-modal.modal1 should be same as modalId
<b-btn v-b-modal.modal1>Banka: {{ data.offer.client_name }}</b-btn>
<!-- Modal Component -->
<b-modal :id="modalId" title="Oferta">
<p clas="my-4">Kampanja: {{ data.offer.campaign_name }}</p>
<p clas="my-4">Norma e interesit: {{ data.offer.interest_rate_nominal }}</p>
<p clas="my-4">*Shpenzimet Administrative: {{ data.offer.admin_fee }}</p>
<p clas="my-4">Kësti Mujor: {{ data.offer.monthly_payment }}</p>
</b-modal>
</div>
</template>
<script>
export default {
props: ['data'],
computed:{
modalId(){
return 'modal' + this.data.i;
}
}
}
</script>
Hier ist eine Methode, die
<tbody>
<tr v-for="(offer, i) in offers">
<td>
<app-show-details :data="{offer, i}"></app-show-details>
</td>
</tr>
</tbody>