From 94f51190e4630fb1376e4fe9fbadf552ad1c441f Mon Sep 17 00:00:00 2001 From: BTMuli Date: Wed, 8 Mar 2023 22:53:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(app):=20=E4=BC=98=E5=8C=96=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index af2ac7c5..87953fb1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,18 +29,30 @@ export default defineComponent({ if (!appStore.loading) { try { await fs.readDir(`${appStore.dataPath.app}`); - await fs.readDir(`${appStore.dataPath.user}`); - await fs.readDir(`${appStore.dataPath.merge}`); } catch (e) { await fs.createDir("appData", { dir: BaseDirectory.AppLocalData }); + } + try { + await fs.readDir(`${appStore.dataPath.user}`); + } catch (e) { await fs.createDir("userData", { dir: BaseDirectory.AppLocalData }); + } + try { + await fs.readDir(`${appStore.dataPath.merge}`); + } catch (e) { await fs.createDir("mergeData", { dir: BaseDirectory.AppLocalData }); } await console.log("检测到数据未加载,开始加载数据..."); - TGAppDataList.map(async item => { + TGAppDataList.AppData.map(async item => { await fs.writeFile( `${appStore.dataPath.app}\\${item.name}`, - JSON.stringify(item.data, null, 2) + JSON.stringify(item.data, null, 4) + ); + }); + TGAppDataList.MergeData.map(async item => { + await fs.writeFile( + `${appStore.dataPath.merge}\\${item.name}`, + JSON.stringify(item.data, null, 4) ); }); appStore.loading = true;