How to make a vue component instance correspond to a module in vuex?

I defined a vue component named ManagePage as a generic component for managing pages. The data and methods in the generic component are all mapped to state, actions, or mutations in vuex. Then, each management page (for example, the page that manages vehicle information) is an instance of the component that corresponds to a specific module in vuex (for example, this.$store "passport").

I try to pass the module"s named "passport/truck" to the ManagePage component as a parameter (prop:store), and then let mapState,mapActions and other methods map the state, actions, or mutations in the vuex to the component"s data, methods. However, it is found that the location of the first parameter of mapState cannot be obtained by using this.store to get the name of the module.

want to know how to solve it? Or is there another solution. The purpose of using vuex is to be able to easily call the method and change the state within the component in other places such as the parent component of the component (for example, calling the mutation, of openAddItemDialog () outside the component to change the state, of showAddItemDialog and then modify the showAddItemDialog variable that controls whether the dialog box in the component is displayed or not, pop-up dialog box)

Dec.29,2021

ide/modules.html-sharp%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" rel=" nofollow noreferrer "> https://vuex.vuejs.org/zh/gui.
writes clearly


still hasn't found a way to take an attribute in prop or data as the first parameter of mapState, but it can be solved in the old way.

    computed: {
        list() {
            return this.$store.getters[`${this.moduleName}/list`];
        }
    }
Menu