web前端全系列 教程
1839个小节阅读:2243.9k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
本地存储也是实际项目中必备的接口,一些用户信息、数据信息等需要存储到本地
将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口
xxxxxxxxxx
uni.setStorage({
key: 'storage_key',
data: 'hello',
success: function() {
console.log('success');
}
});
从本地缓存中异步获取指定 key 对应的内容
xxxxxxxxxx
uni.getStorage({
key: 'storage_key',
success: function (res) {
console.log(res.data);
}
});
异步获取当前 storage 的相关信息
xxxxxxxxxx
uni.getStorageInfo({
success: function (res) {
console.log(res.keys);
console.log(res.currentSize);
console.log(res.limitSize);
}
});
从本地缓存中异步移除指定 key
xxxxxxxxxx
uni.removeStorage({
key: 'storage_key',
success: function (res) {
console.log('success');
}
});
清理本地数据缓存
xxxxxxxxxx
uni.clearStorage()
实时效果反馈
1. uni-app中,本地存储中,删除指定存储信息的方法是:
A setStorage
B getStorage
C removeStorage
D clearStorage
答案
1=>C