# LocalStorage方法
# 一,设置localStoreage
import {z_localStoreage} from "./localstorage.js";
z_localStoreage.setValue('zhang',{name:1})
z_localStoreage.setValue('zhang2',1)
z_localStoreage.setValue('zhang3','好')
参数 | 说明 |
---|---|
key | 键名 |
value | 值 |
# 二,获取localStoreage(不存在则返回null)
import {z_localStoreage} from "./localstorage.js";
console.log(z_localStoreage.getValue('zhang'))//{name: 1}
console.log(z_localStoreage.getValue('zhang2'))//1
console.log(z_localStoreage.getValue('zhang3'))//好
参数 | 说明 |
---|---|
key | 键名 |
# 三,修改localStoreage(不存在则新增)
import {z_localStoreage} from "./localstorage.js";
z_localStoreage.updateValue('zhang3','非常好')
z_localStoreage.updateValue('zhang',{name:222})
//修改之后查询
console.log(z_localStoreage.getValue('zhang3'))//非常好
console.log(z_localStoreage.getValue('zhang'))//{name:222}
参数 | 说明 |
---|---|
key | 键名 |
value | 值 |
# 四,删除localStoreage
import {z_localStoreage} from "./localstorage.js";
z_localStoreage.deleteValue('zhang')
参数 | 说明 |
---|---|
key | 键名 |