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

    Global class or Vuex store ?

    Framework
    2
    3
    299
    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.
    • I
      Incremental last edited by

      Hello, I’m quite new to Vue and I’d like to have global functions manipulating color palettes which could be called from evry component to manipulate and storing color parameters.

      Excuse my naive question, but should I use Vuex for this ?
      I tried during many days to have global functions in a store, without success as they are always undefined…

      Is there a better way to declare global functions and data in Vue or Quasar ?
      Thanks

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @Incremental last edited by

        @Incremental

        manipulating color palettes which could be called from evry component to manipulate and storing color parameters.

        This is exactly what Vuex is for: Storing and mutating state that can be shared between components.

        I tried during many days to have global functions in a store, without success as they are always undefined…

        You have to play by the vuex rules to mutate data with mutations( and optionally actions).

        Here are some articles:

        https://forum.quasar-framework.org/topic/10/proper-way-of-using-quasar-with-vuex

        https://techformist.com/access-vuex-store-quasar/

        I recommend these courses if you are new to vue and quasar, helped me a lot:

        https://www.udemy.com/course/quasarframework/

        https://www.udemy.com/course/vuejs-2-the-complete-guide/

        1 Reply Last reply Reply Quote 1
        • I
          Incremental last edited by

          Thanks dobbel, but I already made a complex store with Axios use , in a regular Vue App.
          If I post here it’s because I moved to Quasar and I’m unable to make a function call with parameters in the store.
          Cf. my other post : https://forum.quasar-framework.org/topic/6927/vuex-getter-undefined/4

          1 Reply Last reply Reply Quote 0
          • First post
            Last post