Within VueJS we have two options to manipulate the data that are within the reach of our instance of VueJS :
METHODS EXAMPLE
let app = new Vue({
el: '#app',
data:{
valor: 0
},
methods:{
aumenta(){
return console.log(this.valor)
}
},
created(){
this.aumenta()
}
})
That is invoked like this
<button @click="aumenta(valor += 1)">Métodos</button>
EXAMPLE OF COMPUTED PROPERTIES
let app = new Vue({
el: '#app',
data:{
valor: 0
},
computed:{
aumenta: function(){
return console.log(this.valor += 1)
}
},
created(){
this.aumenta()
}
})
That is invoked like this
<div id="app">
{{ this.aumenta }}
</div>
However: