我在登录页面放了一个sessionStorage存放登录的用户信息,在另一个个人中心页面我想将里面的信息取出,分别填进这个个人信息表格中,请问应该怎么写呀
登录代码如下:
handleSubmit:function (){
this.$refs.userLoginFormRef.validate(async valid => {
if(!valid) return;
const{data: res} = await this.$http.post("login",this.userLoginForm);
if ( res.flag == "ok"){
Cookies.set('username',this.userLoginForm.username)
window.sessionStorage.setItem("user",JSON.stringify(res.user));//存储user对象
this.$message.success("登陆成功~");
this.$router.push({path:"/Home"});
}else {
this.$message.error("登录失败~");
}
})
}
个人中心页面代码如下:
<div class="right" style="float:right;width:640px;">
<el-table :data="tableInfo" border height="120px">
<el-table-column prop="username" label="用户姓名"></el-table-column>
<el-table-column prop="email" label="用户邮箱"></el-table-column>
<el-table-column prop="roles" label="用户角色"></el-table-column>
<el-table-column prop="roles" label="用户状态" ></el-table-column>
</el-table>