lundi 28 septembre 2020

Vue conditional rendering behaves differently for array data when updating

I have some elements on html and they are each rendered based on their own condition. I also needed to update vue data periodically so page will render accordingly. But I noticed that conditions related to array data disappears and appears again in a moment. Here is mycode :

     <button type="button" class="btn btn-success" v-bind:disabled="not == 'Yazıcılar bekleniyor..'" v-if="siparisler.length > 0" v-on:click="sendSiparis('YENI SIPARIS')" id="btn-send-all">SİPARİŞİ KAYDET VE GÖNDER</button>
     <button type="button" class="btn btn-secondary" v-if="masa_musait" v-on:click="guncelle">GÜNCELLE</button>

Here, siparisler is an array and masa_musait is boolean. When vue data updated, second button always stay on page but first button disappears for a moment from page. And this is not a wanted situation. To prevent that, I tried v-show instead of v-if. I also tried to create a boolean type value from siparisler.length > 0 but none of it worked. So I need help about that.




Aucun commentaire:

Enregistrer un commentaire