From 974f672d761d8e6cb076a65e7ddcd87981b42d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 31 Mar 2023 15:41:37 +0800 Subject: [PATCH] =?UTF-8?q?wiki=E6=90=9C=E7=B4=A2=E4=B8=8D=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Wiki/Index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx index 29b4b9390..67bc77116 100644 --- a/src/forge/Wiki/Index.jsx +++ b/src/forge/Wiki/Index.jsx @@ -153,7 +153,7 @@ export default (props) => { function changeSearchValue(value) { if(value){ // 过滤不包含wiki的内容, 重新渲染页面 - let filterList = filterTree(fileList, value); + let filterList = filterTree(fileListInit, value); setFileList(filterList); }else{ setFileList(JSON.parse(JSON.stringify(fileListInit))); @@ -163,8 +163,8 @@ export default (props) => { function filterTree(list, value, arr = []){ if(!list.length) return [] for(let item of list){ - const bool = item.title.includes(value); - let node = JSON.parse(JSON.stringify(item)) + const bool = item.title.match(new RegExp(value, 'i')); + let node = JSON.parse(JSON.stringify(item)); node.children = []; bool && arr.push(node); if(item.children && item.children.length){