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){