Search code examples
javascriptvue.jscomputed-properties

Vue check two computed ready


every time i need to know when several computed values are ready, i write another computed (e.g. isFizzAndBuzzReady)

computed: {
  fizz () {
    return ['f', 'i', 'z', 'z'] // some async data
  },
  buzz () {
    return ['b', 'u', 'z', 'z'] // some async data
  },
  isFizzAndBuzzReady () {
    return this.fizz.length && this.buzz.length
  }
}

Is there a better way to check they are both ready?


Solution

  • Computed is the best way to do this.

    The other way is to do it with $watch but it is imperative and repetitive.