網(wǎng)站首頁 編程語言 正文
js文件
//存儲(chǔ)數(shù)據(jù)
function setStoraged(data1, data2) {
uni.setStorage({
key: data1,
data: JSON.stringify(data2),
})
}
//獲取數(shù)據(jù)
function getStoraged(data1) {
const data = uni.getStorageSync(data1);
if (data) {
return data;
} else {
return [];
}
}
//刪除數(shù)據(jù)
function removeStoraged(data1) {
uni.removeStorageSync(data1);
}
export {
setStoraged,
getStoraged,
removeStoraged
}
頁面應(yīng)用
導(dǎo)入
import {
setStoraged,
getStoraged,
removeStoraged
} from '../../unils/storageData.js'
使用
setStoraged('value', '123');
let datas = getStoraged('colData');
if (datas[0]) {
datasArr = JSON.parse(getStoraged('colData'));
}
removeStoraged('value');
原文鏈接:https://blog.csdn.net/weixin_44283589/article/details/121771796
相關(guān)推薦
- 2023-01-15 PyQt5+QtChart實(shí)現(xiàn)柱狀圖的繪制_python
- 2022-02-15 多標(biāo)簽界面:動(dòng)態(tài)組件 & 異步組件
- 2022-10-02 C++?OpenCV實(shí)戰(zhàn)之手寫數(shù)字識(shí)別_C 語言
- 2022-05-08 react實(shí)現(xiàn)導(dǎo)航欄二級(jí)聯(lián)動(dòng)_React
- 2022-08-26 如何利用python在剪貼板上讀取/寫入數(shù)據(jù)_python
- 2022-09-19 Tomcat配置HTTPS訪問的實(shí)現(xiàn)步驟_Tomcat
- 2022-04-28 python實(shí)用的快捷語法技巧大全_python
- 2023-01-20 Python中用try-except-finally處理異常問題_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支