el-tree組件過來吧默認打開全部子節點


//搜索到節點必須打開此節點所有子節點,因為默認是不會打開子節點的,所以手動設置打開的最高層級。本次我設置了最大四個層級
      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);
        }
      },

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM