1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| /**
| * 存储localStorage
| */
| export const setStore = (name, content) => {
| if (!name) return;
| if (typeof content !== 'string') {
| content = JSON.stringify(content);
| }
| uni.setStorage({
| key:name,
| data:content
| });
| }
|
| /**
| * 获取localStorage
| */
| export const getStore = name => {
| if (!name) return;
| let json = uni.getStorageSync(name);
| if(!json) return;
| return JSON.parse(json);
| }
|
| /**
| * 删除localStorage
| */
| export const removeStore = name => {
| if (!name) return;
| uni.getStorageSync(name);
| }
|
|