mercredi 9 novembre 2022

Setting condition for vue bootstrap checkbox component prop

I am new to Vue and I have to fix the following issue for work. I have a Bootstrap Vue b-form-checkbox-group similar to the one bellow. The listofOption comes from backend and from legacy databses. Sometime the ColumnName is empty or null. Right now it shows null or a blank space, but I want it to print the text "_blank" if that is the case.

<b-form-checkbox-group id="flavors"
   v-model="status"
   :options="listofOption"
   :text-field="ColumnName"
   :value-field="ColumnName"
    name="flavors" class="ml-4" aria-label="Individual flavours" stacked>
</b-form-checkbox-group>

I have replaced the :text-field with the following line but can't make it work:

:text-field="[(ColumnName && ColumnName != null && ColumnName != '') ? ColumnName : '_blank']"



Aucun commentaire:

Enregistrer un commentaire