# wx.setStorageSync(string key, any data)

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6

wx.setStorage The synchronous version of

# parameter

# string key

Specified in the local cache key

# any data

The content that needs to be stored. Supports only native types, Date, and the ability to passJSON.stringifySerialized object.

# sample code

wx.setStorage({
  key:"key",
  data:"value"
})
try {
  wx.setStorageSync('key', 'value')
} catch (and) { }