localStorage sessionStorage JSON.parse JSON.stringify 1个用户好几个权限 用户如果存在某个权限 显示不同页面 存在的问题 当前页面保存到storage里了 复制路径打开新的页面 storage里的数据不同步复制过来 只能保存JSON字符串 不能保存字符串数组

       存
        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/nanianqiming/p/8074641.html

  

posted on 2020-03-31 09:33  左侧岚  阅读(179)  评论(0编辑  收藏  举报

导航