I am using vue-grid-layout to create a draggable tile system, which will keep track of the order of steps to be executed by a system in our research lab. In short, I can create as many grid-item elements as I want by hard coding them, but I need to be able to create a function that will create/remove additional grid-items.
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
How to prevent any routing before some async data (in Vuex store) has loaded?
In my application I need some data to be loaded inside the VueX store before routing starts (for example user sessions). An example of a race condition would be the following: In this situation the route guard might be executed before the user had been received from the server. Using conditional rendering did not help as the route guards are
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:
Vue non reactive data available on instance
I want to store object in vue, it should be available for entire instance and not be reactive. Normally (with reactive) I would use ‘data’ like this: But in fact myObject don’t need to change so I think making it reactive is bad. Is there any method to do this? Answer You can use Vue Instance Properties. There may be
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 state when defining Vue-Router routes
I have the following Vuex store (main.js): I also have the following routes defined for Vue Router (routes.js): I’m trying to make it so that, if Vuex stores the user object, and it has the authenticated property set to false, is has the router redirect the user to the login page. I have this: The problem is I don’t know
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