Home>

The following source is described, but
I can't refer to the value of mapGetters well.

To execute store hoge/hoge with fetch
Setting parameters.
I would like to initialize the item called item of hage/nani test
I can't refer to it.

Error message
async fetch ({store, error, query, route, from, app})
  {
    try {
      await store.dispatch ('hoge/hage', this.test.item)
    }
    catch (e) {
      error ({statusCode: 500});
    }
  },
  computed: {
    ... mapGetters ('hage/nani', ['test'])
  },
Supplemental information (FW/tool version etc.)
  • Answer # 1

    Since

    fetchandasyncDataoperate before instance creation,thiscannot be accessed.
    For this reason, map values ​​such asmapGetterscannot be accessed and must be referenced from the context store.

    store.getters ['hoge/nani']
    store.getters ['hoge/nani'] (value) // If it takes an argument