Nuxt 3 searchContent 总是返回空结果

问题描述 投票:0回答:1

所以我试图添加搜索功能,但 searchContent() 总是返回空数组。我不明白为什么这不起作用。我的 Markdown 文档位于 /content 中。

这里是一些相关的软件包版本:

  • vue 3.4.19
  • nuxt 3.10.2
  • nuxt/内容2.12.0

我的 nuxt 配置

export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: ['@nuxt/ui', '@nuxt/content'],
  content: {
    experimental: {
      search: {
        indexed: true
      }
    }
  }
})

搜索片段

const keywords = ref('')

const search = lodash.debounce(async () => {
    const res = await searchContent(keywords)
    console.log(res.value)
}, 500)
nuxt.js
1个回答
0
投票

使用

.value

const keywords = ref('')

const search = lodash.debounce(async () => {
    const res = await searchContent(keywords.value)
    console.log(res.value)
}, 500)
© www.soinside.com 2019 - 2024. All rights reserved.