my.getStorageSync

Get cached data synchronously.

This is a synchronous interface.

Sample Code

copy
let res = my.getStorageSync({ key: 'currentCity' });
 my.alert({
    content: JSON.stringify(res.data),
 });

Parameters

NameTypeMandatoryDescription
keyStringYesCache data key

Return Value

NameTypeDescription
dataObject/StringCorresponding content of the key