From 55a662e285935304f39622e839ab95b0d41a36ad Mon Sep 17 00:00:00 2001 From: guoenxuan Date: Thu, 20 Jun 2024 16:35:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DclearStorageSync?= =?UTF-8?q?=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 --- .../apis/harmony-native/StorageCacheAndSyncProxy.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts index e1f8c3ce1e31..c2edd9ae56c7 100644 --- a/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts +++ b/packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts @@ -78,6 +78,16 @@ class ProxyHandler { // this.nativeApi['removeStorage']({key: key}) } } + if (propKey === 'clearStorageSync') { + return (...args: any[]) => { + // 先更新缓存,再同步原生 + this.cacheMap.clear() + + args[0].fail = () => {} + args[0].success = () => {} + Reflect.apply(target.clearStorage, target, args) + } + } if (propKey === 'getStorage') { return (...args: any[]) => {