From 1afaed082ac98e823079df458f1891ac24cff005 Mon Sep 17 00:00:00 2001 From: yangws <1607839436@qq.com> Date: Thu, 12 Sep 2024 16:52:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/renderer/src/plugins/shareStore.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 80f69fc..38a2e3a 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@vue-office/excel": "^1.7.11", "@vue-office/pdf": "^2.0.2", "@vueuse/core": "^10.11.0", + "circular-json": "^0.5.9", "cropperjs": "^1.6.2", "crypto-js": "^4.2.0", "echarts": "^5.5.1", diff --git a/src/renderer/src/plugins/shareStore.js b/src/renderer/src/plugins/shareStore.js index e291561..10aec30 100644 --- a/src/renderer/src/plugins/shareStore.js +++ b/src/renderer/src/plugins/shareStore.js @@ -4,6 +4,7 @@ const isNode = typeof require !== 'undefined' // 是否支持node函数 const { ipcRenderer } = isNode?require('electron'):{} // app使用 import { sessionStore } from '@/utils/store' +import CircularJSON from 'circular-json' // import { diff } from 'jsondiffpatch' // const Remote = isNode?require('@electron/remote'):{} // 远程模块 @@ -173,6 +174,7 @@ const findDifferences = (obj1, obj2) => { for (const key in o1) { if (o1.hasOwnProperty(key)) { const newPath = path ? `${path}.${key}` : key; + if(!o2) return if (o2.hasOwnProperty(key)) { const v1 = toJsonStr(o1[key]) const v2 = toJsonStr(o2[key]) @@ -202,6 +204,6 @@ const findDifferences = (obj1, obj2) => { return differences; } // 对象克隆 -const objClone = (obj) => JSON.parse(JSON.stringify(obj)) +const objClone = (obj) => JSON.parse(CircularJSON.stringify(obj)) // 转换为json -const toJsonStr = (obj) => JSON.stringify(obj) +const toJsonStr = (obj) => CircularJSON.stringify(obj) -- 2.44.0.windows.1