localStorage storage object read and write

1. Storage method: Use JSON.stringify to convert objects into JSON strings for storage

example:

Insert picture description here
Insert picture description here

2. Reading method: define var to receive json into object type

            var obj=JSON.parse(localStorage.getItem("userInfo"));

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41170600/article/details/108724219