# qq.getStorageSync

# any qq.getStorageSync(string key)

qq.getStorage 的同步版本

# 参数

# string key

本地缓存中指定的 key

# 返回值

# any data

key对应的内容

# 示例代码

qq.getStorage({
  key: 'key',
  success(res) {
    console.log(res.data)
  }
})
1
2
3
4
5
6
try {
  const value = qq.getStorageSync('key')
  if (value) {
    // Do something with return value
  }
} catch (e) {
  // Do something when catch error
}
1
2
3
4
5
6
7
8