Created
March 12, 2019 11:15
-
-
Save casgin/86e5f7dd6994deabc8307d20d24313ae to your computer and use it in GitHub Desktop.
[VueMilan Meetup 2802] Computed Property "sommatoria"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
computed: { | |
// --- Definisco la computed property | |
// --- Ogni volta che nel metodo "sommaNumero", avviene il .push | |
// --- sull'array (o ogni qualvolta avviene una modifica su questo array "this.elencoNumeri") | |
// --- viene invocata la funzione | |
sommatoria() { | |
let totale=0; | |
this.elencoNumeri.map( | |
(numero) => { | |
totale += numero | |
} | |
); | |
return totale | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment