According to the Nuxt docs, I should be able to access $config
from within my vuex store:
"Using your config values:
You can then access these values anywhere by using the context in your pages, store, components and plugins by using this.$config
or context.$config
." (emphasis added, from https://nuxtjs.org/docs/2.x/directory-structure/nuxt-config#runtimeconfig)
When I try to access $config
in my store like this:
export const state = () => (
{
// App vital details
app: {
name: 'MyApp',
appVersion: this.$config.appVersion,
copyright: helpers.getCurrentYear()
},
}
)
I get an error message in the console: "Cannot read property '$config' of undefined"
If I try with context.$config
I get error: "context is not defined"
I know $config
is "working" otherwise because I can access it in my templates with $config.appVersion
, but how can I properly access it within my store?
Property '$config' does not exist on type 'Vue'.
Thanks. – Wheelsman