I have a file for configuring my OpenID Connect authentication
export const authMgr = new Oidc.UserManager({ userStore: new Oidc.WebStorageStateStore(), authority: **appsetting.oidc** })
I want to access my state in order to get the value of appsetting.
I did this:
import store from './store' const appsetting = () => store.getters.appsetting
but my appsetting is always returning undefined
what I my missing?
Store:
app.js
const state = { appsetting: appsetting, } export { state }
getters.js
const appsetting = state => state.appsetting export { appsetting }
index.js
export default new Vuex.Store({ actions, getters, modules: { app }, strict: debug, plugins: [createLogger] })
when I print the value of store.getters
, it returns this:
{ return __WEBPACK_IMPORTED_MODULE_2__store__["a" /* default */].getters; }
No the actual store objects
js? To access a Vuex store outside of a component in Vue. js, we can import the store and use it directly.
To access child component's data from parent with Vue. js, we can assign a ref to the child component. And then we can access the child component data as a property of the ref. to assign the markdown ref to the markdown component.
Vuex stores are reactive. When Vue components retrieve state from it, they will reactively and efficiently update if the store's state changes. You cannot directly mutate the store's state. The only way to change a store's state is by explicitly committing mutations.
Try to import 'store' with curly brackets
import {store} from '../store/index' store.getters.appSettings
Another option is to access from the vue property
import Vue from 'vue' Vue.store.getters.appSettings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With