in order to reduce the loading time caused by interaction with the background,
now intends to store the objects acquired from the background in sessionStorage temporarily
and then directly extract
from sessionStorage when needed. However, there may be component reuse in the current page. If the key in sessionStorage in
is the same, the value fetched by all components of
will be the same, causing the display to be inconsistent with expectations.
now you want to use the ID of the component as the key, of sessionStorage
, but after debugging several times, the objects you get are all null
sessionStorage. Do you not support variable key?
if possible, what"s wrong with my method?
I would also like to ask this method of caching back-end information. Is there any better choice for
in addition to sessionStorage?
self.warningData = response.data.data;
var data = self.warningData;
var id = self.myInfoData.id;
sessionStorage.setItem(id,data)