app退出重新登录后,无法获取uni.getStorage之前存储的数据,谢谢
getStorage: function () {
var key = 'KEY'
if (key.length === 0) {
uni.showModal({
title: '读取数据失败',
content: "key 不能为空",
showCancel:false
})
} else {
uni.getStorage({
key: key,
success: (res) => {
uni.showModal({
title: '读取数据成功',
content: "data: '" + res.data + "'",
showCancel:false
})
},
fail: () => {
uni.showModal({
title: '读取数据失败',
content: "找不到 key 对应的数据",
showCancel:false
})
}
})
}
},
setStorage: function () {
var key = 'KEY',
data = 'abc';
if (key.length === 0) {
uni.showModal({
title: '保存数据失败',
content: 'key 不能为空',
showCancel:false
})
} else {
uni.setStorage({
key: key,
data: data,
success: (res) => {
uni.showModal({
title: '存储数据成功',
content: ' ',
showCancel:false
})
},
fail: () => {
uni.showModal({
title: '储存数据失败!想',
showCancel:false
})
}
})
}
},
DCloud_uniCloud_JSON
除非卸载app或者调用接口设置,是不会自动清除缓存的。自定义基座、标准基座都一样
2022-03-07 11:00