my.getStorageSync
Get cached data synchronously.
Supported types of mini programs: DSL
This is a synchronous interface.
Sample Code
copy
let res = my.getStorageSync({ key: 'currentCity' });
my.alert({
content: JSON.stringify(res.data),
});Parameters
| Property | Type | Required | Description |
| key | String | Yes | Cache data key. |
Return Value
| Property | Type | Description |
| data | Object | Corresponding content of the key. |