created() {
this.$http.get('/api/main-page/transports/get-transports').then(response => {
this.personalTransportTabs = response.body.personalTransportTabs;
this.dataLoaded = true;
}).catch(error => {
console.log(error);
});
}
data() {
return {
personalTabs: this.personalTransportTabs
};
},
<el-tab-pane v-for="personalTab in personalTabs" :label="personalTab.name" >{{ personalTab.name }}</el-tab-pane>
created() {
this.$http.get('/api/main-page/transports/get-transports').then(response => {//Эта функция будет выполнена после инициализации
this.$set(this,'personalTabs', response.body.personalTransportTabs);
this.dataLoaded = true;
}).catch(error => {
console.log(error);
});
},
data() {
return {
personalTabs: []
};
},
this.personalTabs = response.body.personalTransportTabs;
personalTabs: this.personalTransportTabs
. Т.к. инициализация data происходит один раз при создании экземпляра.