dimanche 14 avril 2019

VueJS conditional sort data to table

I have data of hotels listing, i need to create table with two columns: in first column others hosts listing, in second column listing of my hotels. I can check it by parameter - client_listing (0 or 1).

But if i'm using v-if it does not create second column it just sckip and place my hotels to first (right column) as result - all listings in one column.

What i want: enter image description here

What i get: enter image description here

My code:

<div class="date-card-body">
  <table class="table table-bordered b-t">
    <thead>
      <tr>
        <th>Others</th>
        <th>My</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="result in dateCard.results">
        <td style="width: 50%" v-if="result.client_listing === 0">Others</td>
        <td style="width: 50%" v-if="result.client_listing === 1">My</td>


      </tr>
    </tbody>
  </table>
</div>

What i'm doing wrong? How to achieve result?

Aucun commentaire:

Enregistrer un commentaire