我在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里写吗,如何解决
9 回答1.6k 阅读✓ 已解决
6 回答934 阅读
3 回答1.3k 阅读✓ 已解决
4 回答940 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
3 回答847 阅读
3 回答1.3k 阅读✓ 已解决
如果是在
action
里用的,this.$http
这条路肯定不通,你有没有想过,this
在actions
里指的是谁?反正我不知道。但你的
action
可以这样写: