My application loops through a list of vegetable crops and displays disease keys and links to control measures for each crop.
For one of the crops (cropid=6), no disease key exists and I cannot stop showing that specific link.
The relevant parts of my code are as follows:
<v-container fluid grid-list-lg> <v-layout justify-center> <v-flex xs12> <h3>Diseases</h3> <v-card v-for="(disease,index) in diseases" :key="index" ripple class="hand" @click="navigateTo(disease.id)" > <v-container> <v-layout fill-height> <v-flex xs12 md8 lg6> <span v-html="$t(disease.link)"></span> </v-flex> </v-layout> </v-container> </v-card> </v-flex> </v-layout> </v-container>
My data part is as follows:
diseases: [ { link: "disease key", id: "k", path: "key" }, { link: "disease controls", id: "d", path: "control" }, ],
How do I stop displaying the "disease key" link if cropID=6?
Thank you/Tom
For conditional display, you need to use
v-if
. Assumingdisease.id
is similar tocropId
, you can use the following code: