当前位置:网站首页>登录之后右上角改变 进入登录状态
登录之后右上角改变 进入登录状态
2022-07-28 04:21:00 【我叫LiLi】
通过currentUser里面的值 如果里面有值就进入 登录显示的组件 没有值就显示未登录的组件
第一步:
通过mapState //获取到登录里面login里的currentUser,然后赋给Menu
同时 reducer里面的user login仓库也增加一个字段currentUser:initUser(),
下次进来的时候不让他进来就是空 在reducer里面的user login仓库写一个initUser方法 从本地获取user
const initUser=()=>{
//从本地获取用户信息
const currentUser=getData('currentUser')
if (currentUser) {
return currentUser
}
return null
}
这样就可以Menu 有props通过currentUser里面的值 如果里面有值就进入 登录显示的组件 没有值就显示未登录的组件
currentUser也会从本地缓存里面读取值 在reducer login里面。(通过initUser方法)
第二点
登录清空和注册同理 reducer里面重新取值
要写设置内容
构建一个页面里面有退出以及更新功能
边栏推荐
- 21 days, fat brother personally takes you to play oauth2
- Kingbasees Security Guide for Jincang database -- 6.1 introduction to strong authentication
- CV2. Threshold(), CV2. Findcontours(), CV2. Findcontours image contour processing
- Domestic high hidden free agent crawler code
- 7/27(板子)染色法判定二分图+求组合数(递推公式)
- [kinematics] simulation of orbital angular momentum based on MATLAB [including Matlab source code 1971]
- Security exception handling mechanism
- The simulation test disconnects the server from the public network
- 金仓数据库KingbaseES安全指南--6.1. 强身份验证简介
- XML file usage and parsing
猜你喜欢
![[coding and decoding] Huffman coding and decoding based on Matlab GUI [including Matlab source code 1976]](/img/af/27e3794f93166d8ecad9b42dafaf0f.png)
[coding and decoding] Huffman coding and decoding based on Matlab GUI [including Matlab source code 1976]
![[performance optimization methodology series] III. core idea of performance optimization (2)](/img/3c/9a2daea9bc136ae48d20d96e8f0402.png)
[performance optimization methodology series] III. core idea of performance optimization (2)

Combination of Oracle and Premier League statistics and presentation

ESP8266 WIFI 模块和手机通信

上班摸鱼打卡模拟器微信小程序源码

校园流浪猫信息记录和分享的小程序源码

过滤器、拦截器、监听器

【day03】流程控制语句

Information system project manager (2022) - key content: Information System Security Management (20)

【无标题】
随机推荐
月薪28K学员 自动化测试经验分享
Linux - MySQL advanced (day19)
7/27(板子)染色法判定二分图+求组合数(递推公式)
un7.27:redis数据库常用命令。
Learn regular expressions (regexp)
C#跨线程刷新前台UI
将数据库拿到的数据渲染到elementUI 中的table中去
The State Administration of market supervision exposes typical cases of food safety
STC timer is abnormal (how to modify the initial value, the timing time is 100ms)
VAE generation model (with VAE implementation MNIST code)
【伸手党福利】微信中h5网页调起扫一扫最简单的方法
《关于我写自定义cell这件事》
[day03] process control statement
The simulation test disconnects the server from the public network
ServletContext、request、response
一名合格的软件测试工程师,应该具备哪些技术能力?
glusterfs 文件未挂载,权限: r-s
Remove screen cutting and copying restrictions
xml文件使用及解析
【无标题】