From 21190fe79357d4bcdfe342ee2e57f3390f74252c Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Fri, 21 Aug 2020 12:17:39 +0800 Subject: [PATCH] =?UTF-8?q?title=20=E5=92=8C=20path=20=E8=BD=AC=E6=88=90?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E9=81=BF=E5=85=8D=E6=89=BE=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/components/DocSearch.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/components/DocSearch.jsx b/examples/components/DocSearch.jsx index e9016929..a3026986 100644 --- a/examples/components/DocSearch.jsx +++ b/examples/components/DocSearch.jsx @@ -27,6 +27,7 @@ export default class DocSearch extends React.Component { } onSearch(query) { + query = query.toLowerCase(); if (query === '') { this.setState({searchResults: []}); return; @@ -43,7 +44,13 @@ export default class DocSearch extends React.Component { .substring(Math.max(0, index - 20), index + 60) .replace(query, `${query}`) }); - } else if (doc.title.indexOf(query) !== -1) { + } else if (doc.title.toLowerCase().indexOf(query) !== -1) { + results.push({ + title: doc.title, + path: doc.path, + abstract: '' + }); + } else if (doc.path.toLowerCase().indexOf(query) !== -1) { results.push({ title: doc.title, path: doc.path,