Tengo matriz de datos en este
"item_tabel": [ { "method": { "select_method": 6, }, "innovation": { "select_innovation": 2, }, } ],¿Cómo calcular usando la suma?
esto es mi computado
subtotalRow() { return this.$store.state.item_tabel.map((item,i) => { return Number(item.method.select_method * item.innovation.select_innovation) //how to sum (item.method.select_method + item.innovation.select_innovation) }); },ejemplo en mi tabla
No | method | inov | total 1 | 6 | 2 | (6+2 = 8) //calculate 2 | 2 | 2 | 4 //calculatesi usar el operador * funciona y si usar + no funciona
gracias
Dado que Array.map() requiere una función de devolución de llamada, se supone que el cuerpo de la función debe estar encerrado entre llaves '{}'
subtotalRow() { return this.$store.state.item_tabel.map( (item,i) => {item.method.select_method + item.innovation.select_innovation} ); }, subtotalRow() { return this.$store.state.item_tabel.map( (item,i) => (item.method.select_method + item.innovation.select_innovation) ); },