Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Vue - v-if no item with that name in the list then show an image
<ul class="ulItems" v-for="item in listingItems" :key="item.channels">
  <li class="liItems">
    {{ item.itemName }}
  </li>
</ul>

I want to display an image in cases where the list does not contain an object with that name

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If I understood you correctly, try like following snippet:

new Vue({
  el: '#demo',
  data() {
    return {
      listingItems: [{itemName: 'aaa', channels: 1}, {itemName: '', channels: 2}, {itemName: 'bbb', channels: 3}],
      noNameImg: 'https://picsum.photos/50'
    }
  }
})

Vue.config.productionTip = false
Vue.config.devtools = false
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <ul class="ulItems" v-for="item in listingItems" :key="item.channels">
    <li class="liItems" v-if="item.itemName">
      {{ item.itemName }}
    </li>
    <li class="liItems" v-else>
      <img :src="noNameImg" />
    </li>
  </ul>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!