getUserInfo(){
            const menu = localStorage.getItem('menu');
            if (menu === '' || menu === 'undefined' || menu === 'null' ) {
            return false;
            }
            const _menu = JSON.parse(localStorage.getItem('menu'));
            if (_menu && _menu.length >= 1) {
               _menu.forEach((item,index)=>{
                    this.treeData.push(this.getTreeNode(item,index))
                })
            }

        },
        getTreeNode(item,index){
            let childrenNode={
                    title:item.purview_name,
                    key:index
                };
                if(item.child && item.child.length){
                    childrenNode.children = [];
                    item.child.forEach((subItem,subIndex) =>{
                        let subkey = `${index}-${subIndex}`
                        childrenNode.children.push(this.getTreeNode(subItem,subkey))
                    });
                }
                return childrenNode
        }
Logo

前往低代码交流专区

更多推荐