For example, this position , There is a user name , Age , Three user information , How to store appropriate ？
vuex+localstorage? There are other plans
current position：Home>Where is the user information obtained by the front end
Where is the user information obtained by the front end
Other answers 1：
The common front-end storage solutions I know ：Cookie,LocalStorage and SessionStorage.
There are many schemes ：https://www.cnblogs.com/minig....
Users' privacy information should be stored carefully , Delete in time .
Other answers 2：
Look at your project .
Larger ones vuex It may be easy to manage .
General use localStorage It will be more concise .
Other answers 3：
In the case of your screenshot, there is no need for additional storage .
After logging in, the front end should use sessionStorage Storage token（ because localStorage It will not be automatically destroyed after the page is closed ）, Then call... When needed api Just ask for data .
As far as your screenshot is concerned , This component completes itself api Once the data is requested and displayed, the task is over , No need to store data . The so-called storage is when the same data needs to be used in multiple components , Caching data for the purpose of avoiding frequent requests . So how to save it doesn't matter , Just get it .
What you need to focus on is ： If you use memory to store data , So how to ensure that the data is reloaded after refreshing the page .
Other answers 4：
To get to know store.js Well .
author[segmentfault],Please bring the original link to reprint, thank you.
The sidebar is recommended
- Vuepress packaging deployment stepping on the road of the pit
- Automatic import of less
- Bootstrap blazor table component (III) intelligent generation
- Based on centos7 + nginx + Daphne + uwsgi + django3 2 + supervisor + mysql8 single architecture server production environment deployment (I)
- Differences between vue2 and vue3 named slots
- Vue3: Axios cross domain request problem
- The difference between vue2 and vue3: keep alive
- Configure nginx and SSL certificate for Django project under Windows Environment
- Ant Design Vue: a-table custom column
- Using jQuery in Vue
guess what you like
Vue dynamic loading picture problem
Icons using Alibaba vector icon library in Vue
Java Android mobile phone automatic basic learning element positioning
Rancher configuring HTTPS domain name to access graphic tutorial
Building a blog with GitHub pages + hexo (7) how to delete a published article successfully solved: delete it at the same time deploy_ Git folder
Eight blog views / hexubs
Build a blog with GitHub pages + hexo (9) set the next theme of hexo blog, and only part of the home page is displayed (not the full text)
Building a blog with GitHub pages + hexo (10) the next theme of hexo blog mathjax mathematical formula rendering problem
Hexo/Github. IO configure Tencent cloud CDN
Rich text editor: ckeditor (using ckeditor4 Vue)
- The get request of nginx agent only returns part of the data. The problem is solved
- HTTP keep alive details
- [technical update] http / 3 quic Foundation
- Vue to react ----- can the constructor be omitted when using ES6?
- Use of nested HTML
- Vue to react to realize slot function
- When to use react PureComponent
- Details of Vue to react useeffect
- React 16.6 memo()
- Deep understanding of children https://segmentfault.com/a/1190000011527160
- This paper solves the cross domain problem Vue + springboot caused by the separation of front and back ends
- Definition of Vue slot
- 'interface' declarations can only be used in typescript files in Vue 3.0 + ts resolvent
- Source code analysis, Vue What happens when using (), take initializing vuex as an example
- Source code analysis, Vue global API set, del, nexttick, use, mixin, etc
- Brief introduction of Vue source code directory design
- Docxtemplator + Vue + docxtemplator image module free realize the front-end Word Download Text and free image download
- vue 2. What happens when x source code analyzes new vue()
- Vue bidirectional binding principle
- Use and principle of Vue keepalive
- Properties and usage of vuex
- Communication mode between Vue components
- Front end interview Foundation
- Usage scenario and principle of Vue nexttick
- Configuration and use of rich text editor ckeditor4 in Vue
- How does Java randomly get elements from a list
- Study summary of pytext: a search path from NLP research to production
- Tunnel http://bt3xna.natappfree.cc Invalid cannot connect to 188.8.131.52:8080 The web service powered by natapp. Is not available on this port cn
- Next JS using react quill
- Vue Gaode map can only have one start point and end point. How to realize it
- Divide and conquer strategy -- find the k-th smallest element in the array