adhik13th
3 months ago
388
6
Vue

How to loop function in computed

Posted 3 months ago by adhik13th

i have input data ,this input is multiple input and have button to add more field input , i have colomn and this value colomn is like total cost qtt * price .this total cost is showing true in colomn number 1 , but not on colomn number 2, 3 ,4 dst . like on this images. i think i need to loop this total cost on my computed ,

my computed

  computed: { // i need to loop on this but i dont know how 
       
       	totalItems: function() {
	    let total = this.userData[0].qtt * this.userData[0].harga
        this.userData[0].harga_total = total
	    return total
        },

    },

and i have Data like that , and i want to save at harga_total

 data(){
        return{     
            count: 0,
           
            userData:[{
                indukpencairan_id:this.induk,
                nama_barang:'',
                qtt:'',
                satuan:'',
                harga:'',
                harga_total:this.total,// **i want to save at here**
                keterangan:'1933',
                status:'Aktif',
            }],
        }
    },

can someone help this ? better u see this image first and you will know what i mean . sorry for my bad english

Please sign in or create an account to participate in this conversation.