Skip to content

Instantly share code, notes, and snippets.

@casgin
Created March 12, 2019 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save casgin/86e5f7dd6994deabc8307d20d24313ae to your computer and use it in GitHub Desktop.
Save casgin/86e5f7dd6994deabc8307d20d24313ae to your computer and use it in GitHub Desktop.
[VueMilan Meetup 2802] Computed Property "sommatoria"
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