【发布时间】:2022-08-05 13:54:20
【问题描述】:
我正在尝试在我的项目中使用 Nuxt.js 内容。
问题是当我尝试在我的项目中使用 $content 方法时,TypeError: _this.$content is not a function 会发生:
async fetch() {
this.content = await this.$content(\'data\').fetch()
},
我在 Nuxt 配置和 typescript 配置中导入了 @nuxt/content。
nuxt.config.js
export default {
modules: [\'@nuxt/content\']
}
tsconfig.json
{
\"compilerOptions\": {
\"types\": [\"@nuxt/types\", \"@types/node\", \"@nuxt/content\"]
}
}
-
您使用哪个版本的内容?最新的需要 Nuxt3。
-
@kissu 我正式爱你,伙计。更改为 ^1 后,它现在正在工作。非常感谢<333
标签: javascript typescript vue.js nuxt.js