调用promise出错 TypeError: Cannot read property 'then' of undefined


看这错误应该是this.commit('getCode')返回的不是一个promise对象导致,可是我getCode方法已经返回promise了,哪位大神知道怎么改下?
回答:
错误出现在 Store.getOpenid() 中,这里面第一句 commit(...) 后调用了 then,所以从错误信息来看,第一个 commit('getCode') 返回了一个 undefined。
至于为什么返回了 undefined,那就要看 commit() 的定义了
以上是 调用promise出错 TypeError: Cannot read property 'then' of undefined 的全部内容, 来源链接: utcz.com/p/936167.html

