Skip to content

Commit 0c4924d

Browse files
committed
优化存储
1 parent a5497ce commit 0c4924d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/ctool-core/src/helper/storage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {StorageInterface, StorageDataStructureInterface, StorageDataStructure} f
22
import {version} from './util'
33
import platform from './platform'
44
import {isObject} from "lodash";
5+
import {isProxy, toRaw, unref} from "vue";
56
import dayjs from "dayjs";
67

78
const cacheVersion = version.split('.').join('');
@@ -13,8 +14,9 @@ const addKeyVersion = (key: string, is: boolean = true): string => `${is ? `v_${
1314

1415
const encode = <T>(value: T, expiry: number = 0): StorageDataStructureInterface<T> => {
1516
expiry = expiry ? expiry + timestamp() : 0
17+
value = unref(value)
1618
return {
17-
v: value,
19+
v: isProxy(value) ? toRaw(value) : value,
1820
u: dayjs().format('YYYY-MM-DD HH:mm:ss'),
1921
e: expiry,
2022
es: expiry ? dayjs(expiry * 1000).format('YYYY-MM-DD HH:mm:ss') : "",

0 commit comments

Comments
 (0)