methods: {
ShowWindow: function(QueryID) {
this.$data.ID = QueryID;
if(this.GetData())
{
console.log("asdasd")
}
document.querySelector("#EditWindow").style.visibility = "visible";
console.log(this.$data.RowData.name + "asdd");
this.$refs.Title.SetName(this.$data.RowData.name + " " + this.$data.ID);
},
GetData: function(){
const URI = localStorage.getItem("URI") + *URL part 2* + this.$data.ID;
axios.get(URI, this.$parent.$data.optionsAxios).then((result) =>{
this.$data.RowData = result.data;
//console.log(result.data);
console.log(this.$data.RowData.name);
}).catch(err =>{
console.log(err);
})
return true;
}
},
mounted(){
this.$data.ID = this.$route.params.UserID;
this.ShowWindow(this.$data.ID);
this.$data.TableName = this.$parent.TableName;
}
Понятия не имею, почему мой consol.log () работает именно в таком порядке.
Сначала я получаю ответ от этого
console.log("asdasd");
затем
console.log(this.$data.RowData.name + "asdd");
и последний
console.log(this.$data.RowData.name);
Я не знаю, почему он игнорирует то, что находится внутри this.GetData (), и выполняет это последним.
Вывод