【发布时间】:2021-01-20 18:54:23
【问题描述】:
在我的 Nuxt.js 应用程序中访问 this.$vuetify 时,代码中的特定部分出现此错误。
ERROR ERROR in components/equipment/QuickInfoCard.vue:21:20 19:51:29
TS2339: Property '$vuetify' does not exist on type '{ width(): string; height(): "100%" | "9em"; }'.
19 | },
20 | height() {
> 21 | switch (this.$vuetify.breakpoint.name) {
| ^^^^^^^^
22 | case 'sm': return "9em"
23 | default: return "100%"
24 | }
我已经尝试添加 TS 类型,因为这是建议的解决方案
// tsconfig.json
"compilerOptions: [
...
"types": [
"@nuxtjs/vuetify", // <<
"@types/underscore",
"@types/node",
"@nuxt/types",
"@nuxtjs/auth-next"
]
...
]
【问题讨论】:
-
文档还说要添加
@nuxt/vue-app;不知道这是否会有所作为 -
很遗憾没有帮助
标签: typescript nuxt.js vuetify.js