react使用localStorage
作者:互联网
import localStorage from "localStorage";//引入
localStorage.setItem("userInfo", JSON.stringify(res.data.data));//存 localStorage.setItem("user", res.data.data.username); localStorage.setItem("userid", res.data.data.id);
localStorage.removeItem("user");//删除
localStorage.getItem('user')//取
标签:username,res,react,setItem,localStorage,user,使用,data 来源: https://www.cnblogs.com/Jarsmine/p/16395286.html