docusaurus-search-local icon indicating copy to clipboard operation
docusaurus-search-local copied to clipboard

我想把自定义搜索框样式,不想放在top栏的右端

Open qiaofeng1227 opened this issue 2 years ago • 2 comments

image

qiaofeng1227 avatar Mar 07 '22 04:03 qiaofeng1227

一个简单的 hack

你可以自行编写一个 input 组件,然后点击搜索时利用 docusaurus/router 的路由能力跳转到 /search ,查询的内容(以“xxx”为例子)使用 url params 携带,一个例子如下: your-site-name/search?q=xxx 这样可以跳转到插件内置的搜索结果页。

为什么这么做?

由于这个插件没有暴露出内部的 api 或者搜索框组件,所以不能在外部直接调用这部分的能力。

AnteeHub avatar Jun 02 '22 09:06 AnteeHub

You can try like this, in which the author seems swizzled @theme/DocSidebar/Desktop and @theme/Navbar, moved SearchBar from Navbar to DocSidebar.

image

weareoutman avatar Jul 25 '22 10:07 weareoutman