Change vuex store with modules syntax?
-
The default Quasar syntax for the store really bothers me. It has way too much “export const” repetition going on.
Example here: https://github.com/slowaways/quasar-documentation-pp/blob/master/src/store/layout/mutations.js
What I would like is more like this:
https://github.com/vuejs/vuex/blob/dev/examples/shopping-cart/store/modules/cart.jsBut in multiple files. But I can’t seem to get it working.
My getters.js:
const getters = { getAllSignals (state, getters) { return state.signalsList } } export default { getters }
index.js for the module:
import state from './state' import getters from './getters' export default { namespaced: true, state, getters, }
What am I doing wrong?
Error:Uncaught Error: [vuex] getters should be function but "getters.getters" in module "signals" is {}.
-
You need to change your code in getters.js like below.
export default getters