forked from Gitlink/forgeplus-react
Merge branch 'feature_wiki' of http://106.75.45.236:3000/durian/forgeplus-react into gitlink_server
This commit is contained in:
commit
a9e6bb4ec1
|
|
@ -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){
|
||||
|
|
|
|||
Loading…
Reference in New Issue