[Vuejs]-Vue loop using v-for then display only if no condition met

2πŸ‘

βœ…

I would make a computed property named isProcessing:

  • Return true if there’s at least one product is being processed.
  • Return false otherwise.

In the template, use v-if='isProcessing' to show There is not product being processed and v-else to show list of products which are being processed.

computed: {
    isProcessing: function () {
        return this.products.find( product => product.status === 'processing' ) !== undefined
    }
}
πŸ‘€dvnguyen

Leave a comment