当前位置:网站首页>After login, the upper right corner changes to enter the login status
After login, the upper right corner changes to enter the login status
2022-07-28 04:23:00 【My name is Lili】
adopt currentUser The value of the inside If there is value in it, enter Login to the displayed component If there is no value, the unregistered components will be displayed
First step :
adopt mapState // Get to login login Inside currentUser, Then give to Menu
meanwhile reducer Inside user login The warehouse also adds a field currentUser:initUser(),
If you don't let him in the next time you come in, it's empty stay reducer Inside user login Warehouse write one initUser Method Get... Locally user
const initUser=()=>{
// Get user information locally
const currentUser=getData('currentUser')
if (currentUser) {
return currentUser
}
return null
}
In this way, we can Menu Yes props adopt currentUser The value of the inside If there is value in it, enter Login to the displayed component If there is no value, the unregistered components will be displayed
currentUser It will also read values from the local cache stay reducer login Inside .( adopt initUser Method )
Second point
Login emptying and registration are the same reducer Re value inside
Write the settings
Build a page with exit and update functions
边栏推荐
- Information system project manager (2022) - key content: Project Procurement Management (12)
- Information system project manager (2022) - key content: Project Portfolio Management (19)
- Chinese Remainder Theorem of X problem
- Some personal understandings of openpose
- 重要的 SQL Server 函数 - 字符串实用程序
- Idea2022 change the local warehouse and configure Alibaba cloud central warehouse
- Thoroughly understand the sharing function in wechat games
- Regression - linear regression
- 【YOLOv5实战5】基于YOLOv5的交通标志识别系统-YOLOv5整合PyQt5
- Kotlin——函数
猜你喜欢

Fedformer MOE module

Un7.27: how to successfully build a ruoyi framework project in idea?

H. 265 web player easyplayer realizes webrtc video real-time recording function

将数据库拿到的数据渲染到elementUI 中的table中去

2022-7-27 顾宇佳 学习笔记

Esp8266 WiFi module and mobile communication

Construction and use of FTP server and NFS server
![[blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]](/img/72/10bd8a292c3ee3445907795ebf2ae8.png)
[blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]

ServletContext、request、response

"Three no's and five requirements" principle of enterprise Digitalization Construction
随机推荐
7/27(板子)染色法判定二分图+求组合数(递推公式)
[MySQL database] index and transaction (often used in interview)
Esp8266 WiFi module and mobile communication
Citrix virtual desktop tcp/udp transmission protocol switching
Adding DSP library to STM32F103 and its solution
离职前一定要做好这7件事情,少一件都很麻烦。
重要的 SQL Server 函数 - 日期函数
Construction and use of FTP server and NFS server
pl/sql之各参数详解(“箱子模型“)
Kingbasees security guide of Jincang database -- 6.2. Configuration files related to authentication
Solana's "deceptive behavior": making mobile phones and opening stores
22 openwrt uses external kernel and kernel_ config
网页源代码查看竟然有这么多方法!你都知道吗?
Un7.27: how to successfully build a ruoyi framework project in idea?
Go grpc: a solution of connection reset by peer
Kingbasees Security Guide for Jincang database -- 5.2. data integrity protection
Applet form-2
企业数字化建设“三不五要”原则
How much does it cost to build a self built server for ark survival evolution?
26 openwrt port forwarding DMZ UPnP