About sessionStorage's on-demand fetching of json data

Access to sessionStorage mainly involves two methods setItem and getItem

sessionStorage.setItem() is to store data, and getItem is to fetch data

 The localStorage above shows the data stored in a single variable, and the sessionStorage below is stored in a json array.

This is to fetch data from sessionStorage, you can fetch the entire json array, or fetch a single variable according to your needs.

The following is the json data field I stored:

 Here is the printout for fetching a single id:

 

 

Guess you like

Origin blog.csdn.net/CJB2020818/article/details/121055675