一、设置
// 设置localStorage
setLocalStorage() {
var userName = '123123'
localStorage.setItem('userName', userName)
}
二、获取
// 获取localStorage
getLocalStorage() {
var getUserName = localStorage.getItem('userName')
console.log(getUserName, '获取的localStorage')
}