【发布时间】:2019-06-10 11:51:32
【问题描述】:
我的 vuex 操作中有一个 axios 调用
return axios({
method: 'get',
url: `/myurl`,
}).then(function (response) {
context.commit('value', response.data.data);
}),
不过这是在我的组件中调用的
this.$store.dispatch("fetchmystuff")
如何向组件返回值?
过去我将 then() 附加到调度中
this.$store.dispatch("fetchmystuff")
.then(function (response) {
//do some component stuff
}),
但我想先在 vuex 中运行提交,然后向组件返回一些东西。
【问题讨论】: