dlt.getStorage
Introduction
Asynchronously retrieves the value of the specified key from the local cache.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
key | string | Yes | The key of the value to retrieve from the local cache. | |
success | function | No | Callback function for a successful API call. | |
fail | function | No | Callback function for a failed API call. | |
complete | function | No | Callback function that will be executed when the API call is complete (both successful and failed calls). |
success Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | true - successful |
data | string | The stored data |
fail Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | false - failed |
Example Code
// pages/index/index.js
Page({
getStorage() {
dlt.getStorage({
key: "xxx",
success:function(data){
console.log("get data": data)
}
});
},
});