From cd14eb07e8b33746fc72b1d35e2aaba85a85b07f Mon Sep 17 00:00:00 2001 From: enncy <877526278@qq.com> Date: Sun, 12 Jun 2022 14:10:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E4=BF=AE=E5=A4=8D=20store=20?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/store.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/store.ts b/packages/core/src/store.ts index edcb3bcf..db45e6da 100644 --- a/packages/core/src/store.ts +++ b/packages/core/src/store.ts @@ -2,7 +2,7 @@ import defaultsDeep from 'lodash/defaultsDeep'; import { reactive } from 'vue'; import { createReactive } from './core/reactive'; import { OCSLocalStorage, OCSStore } from './core/types'; -import { isInBrowser } from './core/utils'; +import { isInBrowser, useUnsafeWindow } from './core/utils'; import { defaultOCSSetting } from './scripts'; /** @@ -11,7 +11,7 @@ import { defaultOCSSetting } from './scripts'; let store: OCSStore; // 环境检测 -if (isInBrowser()) { +if (isInBrowser() && useUnsafeWindow()) { // 创建响应式存储对象 store = reactive(createStore()); // 初始化本地 @@ -34,7 +34,7 @@ export function getStore() { export function createStore(): OCSStore { /** 默认存储数据 */ // eslint-disable-next-line no-undef - const localStore: OCSLocalStorage = defaultsDeep(isInBrowser() ? GM_getValue('store', {}) : {}, { + const localStore: OCSLocalStorage = defaultsDeep(GM_getValue('store', {}), { setting: defaultOCSSetting, logs: [], alerts: [],