# wx.setStorageSync(string key, any data)

The synchronous version of wx.setStorage.

# Parameters

# string key

The specified key in the local cache

# any data

Contents to be stored can only be native types, dates, and objects that can be serialized via JSON.stringify.

# Sample Code

wx.setStorage({
  key:"key",
  data:"value"
})
try {
  wx.setStorageSync('key', 'value')
} catch (e) { }
点击咨询小助手