【发布时间】:2021-01-13 12:26:34
【问题描述】:
在此处关注文档:https://axios.nuxtjs.org/setup
我在运行yarn dev 时将此错误记录到控制台:
ERROR ERROR in pages/index.vue:51:21 23:01:53
TS7031: Binding element '$axios' implicitly has an 'any' type.
49 | }
50 |
> 51 | async asyncData({ $axios }) {
| ^^^^^^
52 | const ip = await $axios.get('http://icanhazip.com')
53 | return { ip }
54 | }
我已经三重检查了我的nuxt.config.js 和tsconfig.json 中有'@nuxtjs/axios'。
我错过了什么?它在第一次工作时出现了这个错误,我不知道为什么?!
任何帮助表示赞赏,谢谢!
【问题讨论】:
-
你的
tsconfig.json中有@nuxt/types吗? -
感谢您的评论。是的,我确实在里面。 :-/
标签: typescript vue.js async-await nuxt.js typeerror