小编adr*_*aus的帖子

CombinedVueInstance 类型上不存在属性

我的打字稿编译器不会将返回的data类型添加到CombinedVueInstance. 我的组件:

\n
import Vue from \'vue\';\n\nexport default Vue.extend({\n  data() {\n    return { title: \'\' };\n  },\n  head() {\n    return { title: this.title };\n  },\n});\n
Run Code Online (Sandbox Code Playgroud)\n

在编译时(以及在 Vetur 中),我收到错误Property \'title\' does not exist on type \'CombinedVueInstance<Vue, unknown, unknown, unknown, Readonly<Record<never, any>>>\'.,如果我尝试this.title在计算属性或其他地方使用,同样如此。

\n

I\xe2\x80\x99m 使用 Nuxt (v2.15.7) 在适当的位置配置了 @nuxt/typescript-build 和 @nuxt/types 。

\n

typescript vue.js nuxt.js

5
推荐指数
0
解决办法
780
查看次数

标签 统计

nuxt.js ×1

typescript ×1

vue.js ×1