Skip to content
Advertisement

Tag: vuex

Is it possible to use Vuex mapActions inside an exported module

Is it possible to call Vuex mapActions from a separate module that’s imported into a component? I’m trying to standardize a set of functions in a vue.js web app. I’d like to import them into each component and pass some values the to function operate. I’m using vuex to manage state. Currently each component calls these functions each time they’re

How to save data in Vue instance

The question is quite simple, All I want is to get the data after the AJAX post saved in Vue instace’s data. Here is my code: And after I trigger the getUserAcc(id) method,I try to verify the VMList.user value in browser console,and I get only the id.Seems like after the function is over the data is reset.How could I store

vuex empty state on logout

Quick story of my problem: Absolutely no data is stored in my vuex state when the page loads If the user is logged in(or has info stored in window.localStorage and therefore gets auto logged in) my vuex store retrieves all the info from a socket that requires authentication. Then the user logs out, But my vuex state save still retains

accessing vuex store in js file

Just like in main.js, I’m trying to access my store from a helper function file: But it logs an error: Uncaught TypeError: Cannot read property ‘getters’ of undefined. I have tried Same result. store: How do I make my store available outside of components? Answer The following worked for me:

How to watch store values from vuex?

I am using vuex and vuejs 2 together. I am new to vuex, I want to watch a store variable change. I want to add the watch function in my vue component This is what I have so far: I want to know if there are any changes in the my_state How do I watch store.my_state in my vuejs component?

Accessing Vuex in v-bind

I would like to access a value from a Vuex store module within v-bind. This throws the following error: TypeError: Cannot read property ‘signupForm’ of undefined I have tried adding the following: And replacing the failing line with: as well as a panoply of other things, to no avail. Any ideas? EDIT: Here is my store: Answer Thanks to @wes

Advertisement