v-if is not reactive in tbody?

when dataTable variable has data, v-if is not update itself?

 <tbody>
      <template v-if="dataTable">
           <tr is="devicesRow" v-for="(data,index) in dataTable" :data="data" :index="index" :key="index"></tr>
      </template>
       <template v-else>
           <tr class="text-center" >
            <td class="text-center" colspan="6"><b-spinner  style="width: 4rem; height: 4rem;" variant="primary" type="grow" label="Spinning"></b-spinner></td>
          </tr>
       </template>
     </tbody>



 computed:{
     dataTable:function(){return this.$store.getters.returngetdevices;}}

Upvotes: 0

Views: 183

Answers (1)

Ahmad Noor
Ahmad Noor

Reputation: 149

Please check if dataTable's datatype is a primitive type like number, strings or boolean then it will check boolean if it has non-primitive type like array or object then it will not check boolean.

If datatable is an array please use if dataTable.length or dataTable !== false . if dataTable will be empty it will coerce into false and if dataTable has values it will return true.

Upvotes: 2

Related Questions