@pubinfo/core 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppSetting-Dzj6YBgW.js → AppSetting-CmT5_15W.js} +15 -15
- package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-OWv01eXk.js → HCheckList.vue_vue_type_script_setup_true_lang-CHzkJth7.js} +1 -1
- package/dist/{HToggle-BnESuuPG.js → HToggle-DpDYLh8y.js} +1 -1
- package/dist/HeaderThinMenu-D6jF8yl1.js +4 -0
- package/dist/{PreferencesContent-DBKQJ8Ob.js → PreferencesContent-AXqWatOF.js} +4 -4
- package/dist/{SettingBreadcrumb-DmP1nJLZ.js → SettingBreadcrumb-CBWdS_nO.js} +3 -3
- package/dist/{SettingCopyright-C8_F7BB2.js → SettingCopyright-D5Jhdu1J.js} +2 -2
- package/dist/{SettingEnableTransition-BeJMq6ny.js → SettingEnableTransition-DQJozSZH.js} +2 -2
- package/dist/{SettingHome-yGmbxzJm.js → SettingHome-DAwn9Ypx.js} +2 -2
- package/dist/{SettingMenu-yWnqZqmz.js → SettingMenu-DEQRAtWl.js} +3 -3
- package/dist/{SettingMode-B8fgUhvi.js → SettingMode-bh3I8UBZ.js} +1 -1
- package/dist/{SettingNavSearch--yQEXqEL.js → SettingNavSearch-iYc-eRzY.js} +2 -2
- package/dist/{SettingOther-CSs1_D9L.js → SettingOther-C2TS6okv.js} +2 -2
- package/dist/{SettingPage-Pm7KblGG.js → SettingPage-B2_SNyn5.js} +2 -2
- package/dist/{SettingTabbar-DM5hdlQf.js → SettingTabbar-BETdKJxz.js} +3 -3
- package/dist/{SettingThemes-DqygGgDK.js → SettingThemes-ComNCP3P.js} +12 -11
- package/dist/{SettingToolbar-BP-yWiKo.js → SettingToolbar-D0DTBbbb.js} +2 -2
- package/dist/{SettingTopbar-Dd_SXy2e.js → SettingTopbar-BcO5Hcxm.js} +3 -3
- package/dist/{SettingWidthMode-DOtJg5uB.js → SettingWidthMode-wzTMq96A.js} +1 -1
- package/dist/built-in/pinia-plugin/plugins/persist.d.ts +2 -2
- package/dist/built-in/pinia-plugin/plugins/persistedstate/index.d.ts +3 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/persistedstate.d.ts +15 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/types.d.ts +150 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/utils.d.ts +17 -0
- package/dist/core/ctx.d.ts +1 -0
- package/dist/core/interface.d.ts +26 -1
- package/dist/core/utils/index.d.ts +2 -0
- package/dist/features/composables/index.d.ts +1 -0
- package/dist/features/composables/partyLogin.d.ts +7 -1
- package/dist/{index-npW0xuOi.js → index-6W8u4oWQ.js} +1 -1
- package/dist/{index-igxVB1m3.js → index-B9i7R1pn.js} +2 -2
- package/dist/{index-C88VclMA.js → index-BXLF9xfN.js} +16300 -15834
- package/dist/{index-CnbD4YWA.js → index-C5X0cH7a.js} +3 -3
- package/dist/{index--xVOZLmn.js → index-CMSPnrUx.js} +1 -1
- package/dist/index-DSKHePRb.js +4 -0
- package/dist/{index-D8kKHmiD.js → index-FATjHAwl.js} +1 -1
- package/dist/{index-BSTB6EhQ.js → index-_VKoUSGo.js} +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -12
- package/dist/{pick-l2RrF3SE.js → pick-BvMRfqim.js} +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/package.json +9 -8
- package/src/built-in/pinia-plugin/index.ts +2 -2
- package/src/built-in/pinia-plugin/plugins/persist.ts +15 -4
- package/src/built-in/pinia-plugin/plugins/persistedstate/README.md +551 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/index.ts +3 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/persistedstate.ts +575 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/types.ts +162 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/utils.ts +46 -0
- package/src/core/ctx.ts +24 -1
- package/src/core/interface.ts +31 -1
- package/src/core/resolver/icon.ts +1 -1
- package/src/core/utils/index.ts +2 -0
- package/src/features/composables/index.ts +1 -0
- package/src/features/composables/partyLogin.ts +180 -38
- package/src/features/context/index.ts +1 -1
- package/src/index.ts +7 -5
- package/src/utils/index.ts +0 -1
- package/src/utils/proxy.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/pinia.d.ts +94 -0
- package/dist/HeaderThinMenu-Co2S6vIB.js +0 -4
- package/dist/index-GSKGoyv_.js +0 -4
- /package/dist/{utils → core/utils}/global.d.ts +0 -0
- /package/dist/core/{utils.d.ts → utils/utils.d.ts} +0 -0
- /package/src/{utils → core/utils}/global.ts +0 -0
- /package/src/core/{utils.ts → utils/utils.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as ae, ref as q, createVNode as f, shallowRef as ce, onMounted as qe, onUnmounted as ua, watch as ge, computed as P, Fragment as Ke, provide as Xe, inject as We, toRaw as jr, toRef as ke, getCurrentInstance as ca, onBeforeUnmount as nt, Transition as pl, withDirectives as vl, vShow as ml, watchEffect as Ae, unref as ct, Teleport as jl, useAttrs as rd, createTextVNode as vo, nextTick as ht, onBeforeUpdate as Cs, getCurrentScope as id, onScopeDispose as sd, toRefs as ao, isVNode as dt, cloneVNode as Yr, reactive as nn, onUpdated as Yl, onActivated as Xl, onBeforeMount as ud, Text as xs, mergeProps as lt, useTemplateRef as ln, Comment as cd, resolveDynamicComponent as Xr, createElementBlock as dd, openBlock as fd, createElementVNode as pd, withCtx as Gr, isRef as Ur } from "vue";
|
|
2
|
-
import { a as vd, u as md, C as hd, b as gd, A as bd, d as yd, f as $d, _ as Ss, c as Cd, F as xd } from "./index-
|
|
3
|
-
import { S as La, s as ws, c as Sd, d as wd, w as Le, e as y, f as Et, g as ze, i as kt, o as et, h as Tt, j as A, k as mo, l as Wt, P as Y, T as da, m as se, n as Pd, p as gt, q as we, r as _e, t as Fe, v as Id, x as kd, y as ft, z as Td, A as rt, B as rn, C as qo, D as Ps, E as it, F as Is, G as ks, H as Ts, I as Os, J as Ds, K as zn, L as Ze, M as Gl, N as jt, R as uo, O as Me, Q as Od, U as fa, V as lo, W as he, X as hl, Y as qr, Z as It, $ as gl, a0 as sn, a1 as bt, a2 as Dd, a3 as Cn, a4 as Md, a5 as Ed, a6 as un, a7 as Rd, a8 as Ms, a9 as Ye, aa as ut, ab as Nd, ac as Es, ad as Ve, ae as Ul, af as Rs, ag as ql, ah as Qo, ai as _d, aj as de, ak as bn, al as Jo, am as Ns, an as Bd, ao as Ad, ap as _s, aq as je, ar as Je, as as Ql, at as Zn, au as pa, av as Hd, aw as Fd, ax as Ka, ay as Jl, az as Zl, aA as zd, aB as Bs, aC as Rn, aD as Vd, aE as Ld, aF as Kd, aG as cn, aH as Yt, aI as va, aJ as ma, aK as er, aL as As, aM as Wd, aN as bl, aO as Hs, aP as jd, aQ as Zo, aR as Yd, aS as co, aT as Xd, aU as ha, aV as Fs, aW as zs, aX as Vs, aY as Ls, aZ as Gd, a_ as Ud, a$ as qd, b0 as Vn, b1 as tr, b2 as ga, b3 as Qd, b4 as Zt, b5 as Jd, b6 as Qr, b7 as Zd, b8 as ef, b9 as Jr, ba as Zr, bb as ea, bc as tf, bd as nf, be as of, bf as af, bg as lf, bh as rf, bi as yl, bj as sf, bk as Ks, bl as nr, bm as xt, bn as uf, bo as cf, bp as df, bq as ff, br as pf, bs as vf, bt as mf, bu as hf, bv as ei, bw as ti, bx as gf, by as bf, bz as yf, bA as Ws, bB as fo, bC as or, bD as $f, bE as Cf, bF as xf, bG as Sf, bH as js, bI as wf, bJ as Pf, bK as If, bL as kf, bM as Tf, bN as ni, bO as Of, bP as Df, bQ as Mf, bR as Ef, bS as Rf, bT as Nf, bU as _f, bV as oi, bW as Bf, bX as Xt, bY as Ln, bZ as ba, b_ as ya, b$ as Af, c0 as Hf, c1 as Ff, c2 as zf, c3 as ai, c4 as Vf, c5 as Lf, c6 as Kf, c7 as Wf, c8 as jf, c9 as Yf, ca as Xf, cb as Gf } from "./index-
|
|
4
|
-
import { p as ar } from "./pick-
|
|
2
|
+
import { a as vd, u as md, C as hd, b as gd, A as bd, d as yd, f as $d, _ as Ss, c as Cd, F as xd } from "./index-FATjHAwl.js";
|
|
3
|
+
import { S as La, s as ws, c as Sd, d as wd, w as Le, e as y, f as Et, g as ze, i as kt, o as et, h as Tt, j as A, k as mo, l as Wt, P as Y, T as da, m as se, n as Pd, p as gt, q as we, r as _e, t as Fe, v as Id, x as kd, y as ft, z as Td, A as rt, B as rn, C as qo, D as Ps, E as it, F as Is, G as ks, H as Ts, I as Os, J as Ds, K as zn, L as Ze, M as Gl, N as jt, R as uo, O as Me, Q as Od, U as fa, V as lo, W as he, X as hl, Y as qr, Z as It, $ as gl, a0 as sn, a1 as bt, a2 as Dd, a3 as Cn, a4 as Md, a5 as Ed, a6 as un, a7 as Rd, a8 as Ms, a9 as Ye, aa as ut, ab as Nd, ac as Es, ad as Ve, ae as Ul, af as Rs, ag as ql, ah as Qo, ai as _d, aj as de, ak as bn, al as Jo, am as Ns, an as Bd, ao as Ad, ap as _s, aq as je, ar as Je, as as Ql, at as Zn, au as pa, av as Hd, aw as Fd, ax as Ka, ay as Jl, az as Zl, aA as zd, aB as Bs, aC as Rn, aD as Vd, aE as Ld, aF as Kd, aG as cn, aH as Yt, aI as va, aJ as ma, aK as er, aL as As, aM as Wd, aN as bl, aO as Hs, aP as jd, aQ as Zo, aR as Yd, aS as co, aT as Xd, aU as ha, aV as Fs, aW as zs, aX as Vs, aY as Ls, aZ as Gd, a_ as Ud, a$ as qd, b0 as Vn, b1 as tr, b2 as ga, b3 as Qd, b4 as Zt, b5 as Jd, b6 as Qr, b7 as Zd, b8 as ef, b9 as Jr, ba as Zr, bb as ea, bc as tf, bd as nf, be as of, bf as af, bg as lf, bh as rf, bi as yl, bj as sf, bk as Ks, bl as nr, bm as xt, bn as uf, bo as cf, bp as df, bq as ff, br as pf, bs as vf, bt as mf, bu as hf, bv as ei, bw as ti, bx as gf, by as bf, bz as yf, bA as Ws, bB as fo, bC as or, bD as $f, bE as Cf, bF as xf, bG as Sf, bH as js, bI as wf, bJ as Pf, bK as If, bL as kf, bM as Tf, bN as ni, bO as Of, bP as Df, bQ as Mf, bR as Ef, bS as Rf, bT as Nf, bU as _f, bV as oi, bW as Bf, bX as Xt, bY as Ln, bZ as ba, b_ as ya, b$ as Af, c0 as Hf, c1 as Ff, c2 as zf, c3 as ai, c4 as Vf, c5 as Lf, c6 as Kf, c7 as Wf, c8 as jf, c9 as Yf, ca as Xf, cb as Gf } from "./index-BXLF9xfN.js";
|
|
4
|
+
import { p as ar } from "./pick-BvMRfqim.js";
|
|
5
5
|
function Uf() {
|
|
6
6
|
}
|
|
7
7
|
function qf(e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u, a as d, _ as c, b as f } from "./index-
|
|
1
|
+
import { u, a as d, _ as c, b as f } from "./index-BXLF9xfN.js";
|
|
2
2
|
import { defineComponent as x, ref as p, onMounted as v, createElementBlock as m, openBlock as _, createElementVNode as o, createVNode as w, withCtx as b, createTextVNode as g, toDisplayString as k, unref as N } from "vue";
|
|
3
3
|
import { useRoute as S, useRouter as h, onBeforeRouteLeave as B } from "vue-router";
|
|
4
4
|
const C = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ci as Gt, cj as Bt, cd as at, ck as zt, c as Xt, d as lt, cl as kt, cc as Ut, cm as Kt, cn as Yt, e as A, co as Qt, y as Qe, A as $t, t as ye, g as je, m as ue, j as H, a9 as _e, i as Zt, aU as Jt, U as en, cp as tn, bW as nn, a2 as rn, cq as wt, E as Ft, a5 as an, cr as ln, X as on, b0 as St, P as me, cs as Ee, ct as sn, cu as un, aI as cn, aO as fn, aY as dn, cv as mn, cw as gn, bb as Ze, bX as hn, cx as Ot, aj as ce, q as ve, ar as ot, bc as vn, r as Fe, L as pn, cy as yn, cz as bn, cA as xn, f as Pe, aH as $n, cB as We } from "./index-
|
|
1
|
+
import { ci as Gt, cj as Bt, cd as at, ck as zt, c as Xt, d as lt, cl as kt, cc as Ut, cm as Kt, cn as Yt, e as A, co as Qt, y as Qe, A as $t, t as ye, g as je, m as ue, j as H, a9 as _e, i as Zt, aU as Jt, U as en, cp as tn, bW as nn, a2 as rn, cq as wt, E as Ft, a5 as an, cr as ln, X as on, b0 as St, P as me, cs as Ee, ct as sn, cu as un, aI as cn, aO as fn, aY as dn, cv as mn, cw as gn, bb as Ze, bX as hn, cx as Ot, aj as ce, q as ve, ar as ot, bc as vn, r as Fe, L as pn, cy as yn, cz as bn, cA as xn, f as Pe, aH as $n, cB as We } from "./index-BXLF9xfN.js";
|
|
2
2
|
import { computed as E, shallowRef as ee, onMounted as Je, inject as et, provide as tt, defineComponent as ge, ref as xe, onBeforeUnmount as Ct, createVNode as R, cloneVNode as wn, Fragment as Ae, watch as se, Transition as Fn, withDirectives as Sn, TransitionGroup as On, vShow as Cn, watchEffect as De, reactive as Et, toRaw as He, nextTick as qt, unref as ae } from "vue";
|
|
3
3
|
function En(e) {
|
|
4
4
|
return e !== e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ce as a, _ as i, b as u } from "./index-
|
|
1
|
+
import { ce as a, _ as i, b as u } from "./index-BXLF9xfN.js";
|
|
2
2
|
import { defineComponent as d, ref as c, onUnmounted as x, onMounted as f, createElementBlock as m, openBlock as p, createElementVNode as n, createVNode as v, withCtx as _, createTextVNode as w, toDisplayString as g, unref as N } from "vue";
|
|
3
3
|
import { useRouter as k } from "vue-router";
|
|
4
4
|
const b = { class: "absolute left-[50%] top-[50%] flex flex-col items-center justify-between lg:flex-row -translate-x-50% -translate-y-50% lg:gap-12" }, C = { class: "flex flex-col gap-4" }, I = /* @__PURE__ */ d({
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ export type { DropdownMenu, DropdownMenuRender } from './built-in/layout-compone
|
|
|
21
21
|
export { updateWatermark } from './built-in/layout-component/composables/useWatermark';
|
|
22
22
|
export { createRequest, defineIconModule, defineRouteModule, getAllIconModules, getAllRouteModules, readProjectModules, } from './core';
|
|
23
23
|
export * from './core/interface';
|
|
24
|
+
export { clearPersistedState, createContext, getPersistedState, getPubinfoNamespace, setPersistedState, } from './core/utils';
|
|
24
25
|
export * from './features';
|
|
25
|
-
export { cleanup, cleanupWithoutUser,
|
|
26
|
+
export { cleanup, cleanupWithoutUser, createRawContext, publicKeyEncryption, storage, wrapProxy, } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cV as a, cW as t, cX as d, cY as o, cZ as u, c_ as r, c$ as n, d0 as c, d1 as i, dm as
|
|
1
|
+
import { cV as a, cW as t, cX as d, cY as o, cZ as u, c_ as r, c$ as n, d0 as c, d1 as i, dm as P, dn as S, dp as l, ch as f, dq as g, cC as y, dr as b, ds as p, dt as R, dE as L, cU as m, d2 as A, d3 as E, dg as I, dh as M, db as h, dc as x, cT as C, du as T, di as v, d5 as w, dF as O, d6 as j, d7 as B, dJ as K, dH as N, d8 as U, d9 as W, dG as q, dd as D, de as H, dK as _, dI as k, dv as F, dj as V, da as Y, df as z, dk as G, d4 as J, dw as X, dC as Z, dx as $, dL as Q, dM as ee, dA as se, dN as ae, dO as te, dD as de, dP as oe, u as ue, dB as re, dy as ne, a as ce, cS as ie, ce as Pe, dz as Se, cL as le, dl as fe } from "./index-BXLF9xfN.js";
|
|
2
2
|
export {
|
|
3
3
|
a as Copyright,
|
|
4
4
|
t as Layout,
|
|
@@ -9,8 +9,8 @@ export {
|
|
|
9
9
|
n as LayoutTopbar,
|
|
10
10
|
c as Logo,
|
|
11
11
|
i as NotAllowed,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
P as PageHeader,
|
|
13
|
+
S as PageMain,
|
|
14
14
|
l as PartyLoginModal,
|
|
15
15
|
f as PassStrengthValidator,
|
|
16
16
|
g as PubinfoApp,
|
|
@@ -56,14 +56,15 @@ export {
|
|
|
56
56
|
se as useInfo,
|
|
57
57
|
ae as useKeepAliveStore,
|
|
58
58
|
te as useMenuStore,
|
|
59
|
-
de as
|
|
60
|
-
oe as
|
|
61
|
-
ue as
|
|
62
|
-
re as
|
|
63
|
-
ne as
|
|
64
|
-
ce as
|
|
65
|
-
ie as
|
|
59
|
+
de as usePartyLogin,
|
|
60
|
+
oe as useRouteStore,
|
|
61
|
+
ue as useSettingsStore,
|
|
62
|
+
re as useStart,
|
|
63
|
+
ne as useSuccess,
|
|
64
|
+
ce as useTabbarStore,
|
|
65
|
+
ie as useTheme,
|
|
66
|
+
Pe as useUserStore,
|
|
66
67
|
Se as useWarn,
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
le as watchDiffObject,
|
|
69
|
+
fe as wrapProxy
|
|
69
70
|
};
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.2",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"pinia": "^3.0.3",
|
|
32
32
|
"vue": "^3.5.17",
|
|
33
33
|
"vue-router": "^4.5.1",
|
|
34
|
-
"@pubinfo/
|
|
35
|
-
"@pubinfo/
|
|
36
|
-
"@pubinfo/
|
|
34
|
+
"@pubinfo/vite": "2.1.2",
|
|
35
|
+
"@pubinfo/config": "2.1.2",
|
|
36
|
+
"@pubinfo/devtools": "2.1.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@alova/adapter-axios": "^2.0.16",
|
|
@@ -59,12 +59,11 @@
|
|
|
59
59
|
"overlayscrollbars-vue": "^0.5.9",
|
|
60
60
|
"path-browserify": "^1.0.1",
|
|
61
61
|
"path-to-regexp": "^8.2.0",
|
|
62
|
-
"pinia-plugin-persistedstate": "^4.4.1",
|
|
63
62
|
"sortablejs": "^1.15.6",
|
|
64
63
|
"unctx": "^2.4.1",
|
|
65
64
|
"vue-m-message": "^4.0.2",
|
|
66
65
|
"zxcvbn": "^4.4.2",
|
|
67
|
-
"@pubinfo/shared": "2.1.
|
|
66
|
+
"@pubinfo/shared": "2.1.2"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@alova/mock": "^2.0.17",
|
|
@@ -81,6 +80,8 @@
|
|
|
81
80
|
"@vitejs/plugin-vue": "^6.0.0",
|
|
82
81
|
"@vitejs/plugin-vue-jsx": "^5.0.1",
|
|
83
82
|
"alova": "^3.3.4",
|
|
83
|
+
"deep-pick-omit": "^1.2.1",
|
|
84
|
+
"destr": "^2.0.5",
|
|
84
85
|
"pinia": "^3.0.3",
|
|
85
86
|
"shiki": "^3.13.0",
|
|
86
87
|
"type-fest": "^4.41.0",
|
|
@@ -92,8 +93,8 @@
|
|
|
92
93
|
"vite-plugin-dts": "^4.5.4",
|
|
93
94
|
"vue": "^3.5.17",
|
|
94
95
|
"vue-router": "^4.5.1",
|
|
95
|
-
"@pubinfo/config": "2.1.
|
|
96
|
-
"@pubinfo/vite": "2.1.
|
|
96
|
+
"@pubinfo/config": "2.1.2",
|
|
97
|
+
"@pubinfo/vite": "2.1.2"
|
|
97
98
|
},
|
|
98
99
|
"scripts": {
|
|
99
100
|
"dev": "vite build -w -m watch",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ModuleOptions } from '@/core';
|
|
2
|
-
import { createPersistedState } from 'pinia-plugin-persistedstate';
|
|
3
2
|
import { createCleanupPlugin } from './plugins/cleanup';
|
|
4
3
|
import { createFavoritesStoragePlugin } from './plugins/favoritesStorage';
|
|
5
4
|
import { createIframeCachePlugin } from './plugins/iframeCache';
|
|
6
5
|
import { createPersistedStateOptions } from './plugins/persist';
|
|
6
|
+
import { createSyncedPersistedState } from './plugins/persistedstate';
|
|
7
7
|
import { createTabbarStoragePlugin } from './plugins/tabbarStorage';
|
|
8
8
|
/**
|
|
9
9
|
* pinia 统一注册插件
|
|
@@ -15,7 +15,7 @@ export function PiniaPlugin(): ModuleOptions {
|
|
|
15
15
|
const { store } = ctx;
|
|
16
16
|
|
|
17
17
|
// 持久化
|
|
18
|
-
store.use(
|
|
18
|
+
store.use(createSyncedPersistedState(createPersistedStateOptions()));
|
|
19
19
|
|
|
20
20
|
// 各个store的副作用
|
|
21
21
|
store.use(createCleanupPlugin);
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { StateTree } from 'pinia';
|
|
2
|
+
import type { Serializer, SyncedPersistedStateOptions } from './persistedstate';
|
|
3
|
+
import { destr } from 'destr';
|
|
4
|
+
import { storage } from '../../../utils/storage';
|
|
3
5
|
|
|
4
6
|
export function customSerializer(): Serializer {
|
|
5
7
|
return {
|
|
6
8
|
deserialize: (value) => {
|
|
7
|
-
|
|
9
|
+
if (!value) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
const parsed = destr<StateTree | null>(value);
|
|
13
|
+
if (parsed && typeof parsed === 'object') {
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
16
|
+
console.warn('[pinia:persist] invalid persisted state detected, fallback to empty state');
|
|
17
|
+
return {};
|
|
8
18
|
},
|
|
9
19
|
serialize: (value) => {
|
|
10
20
|
return JSON.stringify(value);
|
|
@@ -12,10 +22,11 @@ export function customSerializer(): Serializer {
|
|
|
12
22
|
};
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
export function createPersistedStateOptions():
|
|
25
|
+
export function createPersistedStateOptions(): SyncedPersistedStateOptions {
|
|
16
26
|
return {
|
|
17
27
|
storage: storage.local,
|
|
18
28
|
key: id => `_${id}`,
|
|
19
29
|
serializer: customSerializer(),
|
|
30
|
+
storageArea: 'local',
|
|
20
31
|
};
|
|
21
32
|
}
|