Questions tagged [vuex]

Vuex is a state management pattern + library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion.

Vuex is a data management library by the creator of Vue.js. It is designed to help build larger applications in a more maintainable way by following principles similar to those made popular by Facebook’s Flux library (and subsequent iterations by community like redux).

Principles

  • Terse
  • Testable
  • Reactive
  • Single State Tree
  • Hot Reloading
  • Time Travel (with vue-devtools support)

GitHub: https://github.com/vuejs/vuex Documentation: https://vuex.vuejs.org/en/

7756 questions
2
votes
1 answer

vue b-table customize pagination to show all rows

I am using bootstrap-vue. For pagination of a b-table, I used b-pagination component with the following code for the template:
Per page
Lleif555
  • 33
  • 1
  • 5
2
votes
1 answer

Inserting data in vuex-orm database that is already normalized

Assuming the data i receive is already normalized, or at least the relations. How can this data be inserted into the vuex-orm database? Example JSON data: { "carmodel": [ { "id": 1, "title": "M3", "manufacturer_id": 1 }, …
kimomat
  • 2,211
  • 23
  • 37
2
votes
1 answer

What naming do you use to avoid "stuttering" in Vuex modules?

I've been having a hard time avoiding "stuttering" in Vuex modules. It just seems that most of the time, the module's name is also what it contains. For example, suppose a module that handles users. I name the module file user.js export default { …
LodeRunner
  • 7,975
  • 3
  • 22
  • 24
2
votes
1 answer

Use ES6 classes as vuex store state in Nuxt

When I set ES6 class to state on my vuex store in nuxt I got following warn: WARN Cannot stringify arbitrary non-POJOs EndPoint and When I use object as state is works without warning. So How can I use ES6 classes in my state. My model: export…
BeHappy
  • 3,705
  • 5
  • 18
  • 59
2
votes
2 answers

How to prevent Bootstrap-Vue pagination from automatically resetting

I have multiple views and I want to save state on each one, so the user doesn't have to do the same things again. On one of them, I have a table and I use the bootstrap-pagination component for pagination, so when the user changes page, I send the…
2
votes
0 answers

Importing static local json file to Vue store (exclude from build)

I'm trying to have my add data from a local static JSON file to the Vue vuex store. I want my JSON file separated from the bundle process, so that i can change the content anytime in future, without rebuilding the whole site. I have my json file…
wsgg
  • 934
  • 1
  • 20
  • 43
2
votes
2 answers

Vuex and array.findIndex: cannot find a match

I can't seem to make array.findIndex work and I am sure that there should be a match in the array I am searching for but findIndex always returns a -1. let index = state.bag.findIndex((it) => { it.id === item.id …
2
votes
3 answers

Submit values from multiple components

I am using vuejs-wizard to create registration page, I have each tab in component like this
Peril
  • 1,569
  • 6
  • 25
  • 42
2
votes
0 answers

Is it bad practice to use generic mutations in Vuex?

In order to make a simple vuex store we have created a generic mutation & action which would store any type of object we would like to pass when calling the action. A lot of the examples I have seen online have a mutation for each property being…
DrollDread
  • 321
  • 4
  • 22
2
votes
1 answer

What is the best way to clear the properties of an object in Vuex state

Suppose you have this object in the state of the Vuex store: const state = { profile: { name: "Bob", jobTitle: 'Baker', age: 38, } } In the Vue.js template you can access this object with a computed property like this: