//搜索到节点必须打开此节点所有子节点,因为默认是不会打开子节点的,所以手动设置打开的最高层级。本次我设置了最大四个层级
filterNode(value,data,node) {
if(!value){
return true;
}
let level = node.level;
let _array = [];//这里使用数组存储 只是为了存储值。
this.getReturnNode(node,_array,value);
let result = false;
_array.forEach((item)=>{
result = result || item;
});
return result;
},
getReturnNode(node,_array,value){
let isPass = node.data && node.data.label && node.data.label.indexOf(value) !== -1;
isPass?_array.push(isPass):'';
this.index++;
if(!isPass && node.level!=1 && node.parent){
this.getReturnNode(node.parent,_array,value);
}
},
长风破浪会有时,直挂云帆济沧海