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

    mapMutation with dynamic store

    Help
    2
    2
    85
    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.
    • T
      technowebs last edited by

      I am writing a custom component so that I can reuse it with different stores. I am trying to use mapMutation like this, where storeName is a prop passed from the parent component

      methods: {
           ...mapMutations(`${this.storeName}`, ['someVariable']),
      }
      

      But, this is generating the below error,
      Uncaught TypeError: Cannot read property ‘storeName’ of undefined

      Any suggestion will be helpful, thanks

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

        @technowebs said in mapMutation with dynamic store:

        …mapMutations(${this.storeName}, [‘someVariable’]),

        I think it goes like this:

        ...mapMutations('moduleName', ['mutationName']),
        

        if you store the module name in the component:

        ...mapMutations(this.storeName, ['mutationName']),
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post