0
I would like to know how to add up the values of a array
to appear on the screen. Example has a column with gross value, which contains the gross value of each component, wanted to add these values.
That one columns
, imports from a template data-table
the gross value data
data() {
return {
columns: [ name: "valorbruto",
label: "Valor Bruto",
field: "valorbruto",
type: "money",
width: 4,
dontbreak: true,
sortable: true
},]
I tried that code and then interpolate, but it didn’t work.
Computed: {
Valores(){
const ValorBrutoTotal = valorbruto
.reduce((acc, current) =>
acc + current, 0);
return ValorBrutoTotal;
console.log(ValorBrutoTotal)
}
},
Try to improve your example. You want to add up all properties
width
? I ask this because it is the only number present in the object you put in the question.– Luiz Felipe
want to add the raw value, the raw value comes from the backend bringing values, I wonder how I do a computed to put on screen the overall result of the raw value array
– Christian Guimarães