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

    Solved: Vuex actions this.$

    Help
    vuex
    2
    3
    1741
    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.
    • S
      silentcoast last edited by silentcoast

      Good Evening!

      I’ve been working on converting our app over to the newest .15 version that was released. I had a question come up thought that I’m curios on how y’all handle it. I’m fairly new to Vue as well so may be a basic question.

      Prior to .15 I was throwing axios and a few other general items into the window, now I’m trying to use them inside a plugin. Inside of my “auth” store actions.js file I’m trying to access some functions included in some of the plugin files. For example “this.$axios”. I can access these easily from the pages or components folders just not from anything inside the stores folder. Should I be accessing it differently? Heres what I’ve tried:
      Vue.$axios
      Vue.prototype.$axios

      Again probably something simple but racking my brain on this one!

      1 Reply Last reply Reply Quote 2
      • S
        silentcoast last edited by

        Yeah I was over thinking it I guess. All I had to do was import Vue and all my prototype methods were then available. I didnt think it would work like this because I was assuming it would create a new instance of Vue and not have the same setup as the initial/main instance.

        1 Reply Last reply Reply Quote 0
        • benoitranque
          benoitranque last edited by benoitranque

          Couple ways to go about it. One is to add a named export to your plugins and import that in stores. Another is to pass the vue instance to the store when dispatching actions

          Edit:
          You can access the vue instance from the store using this._vm

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