samedi 4 avril 2020

if else statement under nested loop in vue.js show the exact value

<div class="post" v-show="blogs.length" v-for="blog in blogs" :key="blog.id">
                        <span v-for="like in blog.likes" :key="like.id"> 
                          <span v-if="blog.id === like.blog_id  && like.user_id === authUserId"> <a       href="#"  class="link-black text-sm"><i class="fas fa-thumbs-down mr-1"></i> UnLike ()</a></span>
                          <span v-else> <a href="#" class="link-black text-sm"><i class="fas fa-thumbs-up mr-1"></i> Like ( )</a></span>
                        </span>
   </div>

I'm trying to make a loop to show blog post and inside the loop make another loop to fetch blogs likes and if auth user liked then like button show or dislike button show using if statement under nested look but the main loop keeps giving 2 buttons instead of one when multiple users likes that blo

condition are not working

Aucun commentaire:

Enregistrer un commentaire