TypeError: _this.$content is not a function - Nuxt.js Content

Viewed 532

I am trying to use Nuxt.js Content in my project. The problem is that when I try to use $content method in my project the TypeError: _this.$content is not a function occurs:

async fetch() {
  this.content = await this.$content('data').fetch()
},

I imported the @nuxt/content in Nuxt config and in typescript config.

nuxt.config.js

export default {
  modules: ['@nuxt/content']
}

tsconfig.json

{
  "compilerOptions": {
    "types": ["@nuxt/types", "@types/node", "@nuxt/content"]
  }
}
1 Answers
Related