前端小记@store的坑

action 函数返回的是一个promise对象
然后modules除了第一个可以直接通过属性this.$store.dispatch('module1)的方法名')拿到,
其他module需要this.$store.dispatch('module2/module2方法名')
// basics.js
actions: {
        getBid({ commit,state }, param) {
            return xxx
        },
    },
// 调用
this.$store.dispatch('basics/getBid')

posted on 2021-04-12 14:55  fengxiongmiao  阅读(162)  评论(0编辑  收藏  举报

导航