# any wx.getStorageSync(string key)

The synchronous version of wx.getStorage.

# Parameters

# string key

The specified key in the local cache

# Return Values

# any data

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
}
点击咨询小助手