Angular2 用户权限 登录 1个用户有好几个权限 如果其中的权限有admin的话 可以看到所有数据 如果没有admin的话 只能看到1个数据

       
        var storage = window.sessionStorage;                                        //用户权限
        storage.setItem('user',JSON.stringify(result['data']['permissions']));
 
 
        var storage = window.sessionStorage;    
       
        let _this = this;
        setTimeout(function (){
          let _theme = theme;
          for(var i=0; i< JSON.parse(storage["user"]).length; i++){
            if(JSON.parse(storage["user"]).indexOf('admin') !== -1){  
              _this.statusCards = _this.statusCardsByThemes[_theme.name];
            }else{
              _this.statusCards = _this.statusCardsByThemes[_theme.name].slice(1,2);
            }
          }
        }, 200);           
原文地址:https://www.cnblogs.com/zhanglanzuopin/p/12704054.html