No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Change vuex store with modules syntax?

    Help
    2
    2
    1553
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zyme last edited by

      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.js

      But 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 {}.
      
      1 Reply Last reply Reply Quote 1
      • Y
        Younghun Jung last edited by

        You need to change your code in getters.js like below.

        export default getters
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post