[Vuejs]-Rendering component on runtime after Http request in VueJS

0👍

There is no need to have currentTabComponent computed method.

You can just make your HTTP call and update currentTab when it is done.

Something like this:

mounted() {
  fetch('someHttpUrl')
  .then(response => response.json())
  .then(data => {
    this.currentTab = 'Comp1'
  });
  .catch(err => {
    this.currentTab = 'Comp2'
   })
}

I also removed the method named check as it seemed redundant.

Leave a comment