Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muazzamazaz's avatar

vue 3 ref pushing array value infinite times

let arrayOfFunctions = ref([])

     function getTank(tank){
    
        let url = '/gettank/'+tank;
  
        axios.get(url)
               .then(function(response){          
                arrayOfFunctions.value.push(response.data);        
                })
                .catch(function(error){
                       console.log(error);
                 });
      
        }
    
  <tr class="border-b border-slate-200" v-for="(item, index) in farray" :key="item.id">
<td>
{{getTank(item.tankno)}}
      {{arrayOfFunctions}}
</td></tr>

When I call its pushing same values infinite times

enter image description here

0 likes
2 replies

Please or to participate in this conversation.