I am having some problem in vuejs in executing a function/method sequentially. I have three functions like:
MethodA: function(){
if(x = 1){
value1 = 2;
}
if (x ==2){
value2 = 4;
}
this.MethodB();
}
MethodB: function(){
Total value = value1 + value2;
}
MethodC: function (){
this.$http.get('api/getvalue').then(function(response){
this.set('somedata', response.data);
response.data.forEach(para){
if(para.id == 1){
this.MethodA();
}
if(para.id == 2){
this.MethodB();
}
}
});
}
ready: function(){
this.MethodC();
}
I would like to execute this.MethodB()
only after MethodA
and MethodB
has completely executed. How can I do this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire