這里為什么輸出undefined而不是123呢methods: {
release () { this.$store.dispatch('release').then((res) => { console.log(res)
})
}
}vuexactions: {
release (val) {
val.commit('release')
}
}
mutations: {
release () { return new Promise(function (resolve, reject) {
resolve(123)
})
}
}
1 回答

侃侃爾雅
TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
你在mutations
里面的Promise
是return給誰(shuí)呢? 你dispatch
執(zhí)行的是actions的方法啊
再說(shuō)commit
也不支持返回值
添加回答
舉報(bào)
0/150
提交
取消