我在vuex里的actions写this.$http.jsonp请求,结果报错如下:
Uncaught TypeError: Cannot read property '$http' of undefined
请问是为什么,必须在后缀.vue里写吗,如何解决
我在vuex里的actions写this.$http.jsonp请求,结果报错如下:
Uncaught TypeError: Cannot read property '$http' of undefined
请问是为什么,必须在后缀.vue里写吗,如何解决
11 回答1.2k 阅读
4 回答564 阅读✓ 已解决
3 回答859 阅读
2 回答591 阅读
1 回答687 阅读
如果是在
action里用的,this.$http这条路肯定不通,你有没有想过,this在actions里指的是谁?反正我不知道。但你的
action可以这样写: