En esta tabla programada en VUE 2 quiero este resultado:
+-------------------------------------------+
| fact $importe $ acumula consecutivo |
+-------------------------------------------+
| 23 $ 350 $ 350 1 |
| 28 $ 200 $ 550 2 |
| 32 $ 300 $ 850 3 |
+-------------------------------------------+
este es mi código actual:
<tr v-for="movi in movimientos">
<td>{{movi.factura}}</td>
<td>{{movi.importe}}{{acumular(movi.importe)}}</td>
<td> {{saldo}} </td>
</tr>
¿Cómo le hago para obtener el acumulado y el consecutivo en vue ?
mounted(){
this.entrar();
},
data(){
return{
movimientos: null,
saldo: 0
}
},
methods:{
entrar(){
axios.get('miservidor/lee.php?idc='+this.id)
.then((respues) => {
this.movimientos = respues.data;
});
},
acumular(importe){
this.saldo = this.saldo + importe;
}
}
movimientos
esta dentro dedata
, cierto? algo comodata: { movimientos: {factura:23, importe: 350} }
– Javier Cárdenas el 27 dic. 18 a las 2:15