From 020551bd90cfb91b2e32766caf6dbad6fa9d26ac Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Sun, 21 Apr 2024 14:48:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=8F=E5=9C=B0=E5=9B=BE=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E6=AF=94=E4=BE=8B=20&=20=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/main/storage.ts | 9 +++++++++ src/ui/fly.vue | 32 +++++++++++++++----------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/core/main/storage.ts b/src/core/main/storage.ts index 56db08b..4d8211b 100644 --- a/src/core/main/storage.ts +++ b/src/core/main/storage.ts @@ -98,6 +98,15 @@ export class GameStorage { static get(key: string) { return this.list.find(v => v.key === key); } + + /** + * 与Symbol.for类似 + */ + static for(key: string) { + const s = this.get(key); + if (s) return s; + else return new GameStorage(key); + } } window.addEventListener('beforeunload', () => { diff --git a/src/ui/fly.vue b/src/ui/fly.vue index 119bfe1..8bb9380 100644 --- a/src/ui/fly.vue +++ b/src/ui/fly.vue @@ -89,12 +89,7 @@