# wx.getStorage(Object object)

Asynchronously gets the content of the specified key from the local cache.

# Parameters

# Object object

Attribute Type Default Required Description
key string Yes The specified key in the local cache
success function No The callback function for a successful API call
fail function No Callback function for failed API call
complete function No Callback function used when API call completed (always executed whether call succeeds or fails)

# object.success callback function

# Parameters
# Object res
Property Type Description
data any Content of the key

# Sample Code

wx.getStorage({
  key: 'key',
  success (res) {
    console.log(res.data)
  }
})
try {
  var value = wx.getStorageSync('key')
  if (value) {
    // Do something with return value
  }
} catch (e) {
  // Do something when catch error
}
点击咨询小助手