Run computed function after mounted - VUE

If your behavior is synchronous, you can use beforeMount instead of mounted to have the code run before computed properties are calculated.


If your computed property current_user_has_team depends on data which is not available until after the axios call, then you need to either:

  1. In the current_user_has_team property, if the data is not available then return a sensible default value.
  2. Do not access current_user_has_team from your template (restrict with v-if) or anywhere else until after the axios call has completed and the data is available.

It's up to you how you want the component to behave in "loading" situations.