我只是在尝试使用Docusaurus V2,我希望通过LUNR(https://lunrjs.com/)Search启用脱机搜索,如本博客中所述。

https://v2.docusaurus.io/feedback/p/offline-search

我也搜索了文档。

https://v2.docusaurus.io/docs/search/#__docusaurus

我使用“ yarn swizzle @ docusaurus / theme-classic SearchBar”命令安装了,但是在使用“ npm start”运行时没有出现搜索栏。

此外,在src / theme / SearchBar.js中创建了具有此内容的文档:

/**
 * Copyright (c) 2017-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

export {default} from '@docusaurus/Noop';


该文档真的很薄,可能出了什么问题。有可行的例子吗?

如该视频在博客中所述,有可能。
https://canny.io/images/873b18eabf90e91512ac4d0ceb48973b.gif

最佳答案

您需要编辑该文件并实现自己的搜索栏组件。如果要从algolia搜索栏中进行修改,可以改用yarn swizzle @docusaurus/theme-search-algolia SearchBar

08-27 21:21