I'm retrieving an object from my database and somme fields are nullable. I don't know how to check a particular to know the value.
<tr v-for="soin in soins" :key="soin.id">
<td>{{soin.date}}</td>
<td>{{soin.typesoin.name}}</td>
<td>{{soin.categoriesoin.name}}</td>
<td>{{soin.price}}</td>
<td>{{soin.priceWithReduction}}</td>
<!-- Nullable -->
<td>{{soin.rabaisraison.name}}</td>
<!-- If null display nothing, if not, display value. -->
Same when I'm passing data to editing
<!--Buttons-->
<td>
<b-button @click="editingModalSoin(
soin.date, soin.price, soin.priceWithReduction, soin.referedBy, //Values
soin.moyendepaiement.id, soin.rabaisraison.id,
soin.boncadeau.id, soin.bonreduction.id,//FK can be equal to null how do I do that
soin.categoriesoin.id, soin.typesoin.id,//FK
soin.id//rowid
); setCRUDState('edit')"> <font-awesome-icon icon="edit" /></b-button>
<b-button @click="deleteSoin(soin.id)"> <font-awesome-icon icon="trash" /></b-button>
</td>
Thanks for reading
nullis already nothing so nothing will display and when you calleditingModalSoinit'll just pass anullvalue for that parameter. Also I would just pass the object toeditingModalSoininstead of individual parameters to clean your markup up so just@click="eidtingModalSoin(soin)".