美文网首页
react native 存储和读取json并转换为对象

react native 存储和读取json并转换为对象

作者: OK2018 | 来源:发表于2018-06-04 15:57 被阅读0次
    
    //存储
    AsyncStorage.setItem('user',JSON.stringify(object));
    
    //读取
    AsyncStorage.getItem('user').then((value)=>{
          let user = JSON.parse(value);
          this.userId = user.userId;
          this.userName = user.username;
    });
    
    

    相关文章

      网友评论

          本文标题:react native 存储和读取json并转换为对象

          本文链接:https://www.haomeiwen.com/subject/tblysftx.html