我正在尝试在一个组件中使用 nuxt-contnt 它在带有 asyncData 的页面中运行良好,但在组件内部却无法运行
这很好用:
export default {
async asyncData({ $content }) {
const page = await $content('hello').fetch()
return {
page,
}
},
}
但这不起作用:
export default {
data() {
return {
content: [],
}
},
async fetch({ $content }) {
this.content = await $content('hello').fetch()
},
}