search

Home  >  Q&A  >  body text

Is it possible to rely on the getter value of a computed property map inside a block created in a Vue instance?

Wondering if - by the time - accessing a computed property that gets its value from storage - within the created block - I can be sure that the computed value has started.

async created(){
  !this.apps.length && await this.loadApps();
},
computed: {
  ...mapGetters('apps-store', ['apps']),
},

P粉404539732P粉404539732262 days ago543

reply all(1)I'll reply

  • P粉680000555

    P粉6800005552024-04-05 09:12:09

    Hooks are just functions that are fired at the appropriate time - they are announcements not middleware. Therefore, async hooks do not wait to be completed. You should provide default values ​​for application getter__ in the getter function or its state.

    reply
    0
  • Cancelreply