https://taro-docs.jd.com/taro/docs/apis/storage/setStorageSync //官网
Taro.setStorageSync(key, data)
Taro.setStorage({
key:"key",
data:"value"
})
Taro.getStorageSync(key)
Taro.getStorage({
key: 'key',
success: function (res) {
console.log(res.data)
}
}) 或者
try {
var value = Taro.getStorageSync('key')
if (value) {
// Do something with return value
}
} catch (e) {
// Do something when catch error
}
Taro.removeStorageSync(key)
Taro.removeStorageSync('key')