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

PropertyType

Required

Description
keyStringYesCache data key.

Return Value

PropertyTypeDescription
dataObject/StringCorresponding content of the key.