Răsfoiți Sursa

[Mod 0000] 解决清除模型缓存不生效问题

hongrunxia 1 lună în urmă
părinte
comite
6afc40f30a

+ 17 - 5
src/layouts/default/header/components/user-dropdown/index.vue

@@ -139,11 +139,23 @@
       }
 
       function clearModalCache() {
-        if (window['CustomDB']) {
-          const tables = window['CustomDB'].tables[0];
-          tables.clear();
-          location.reload();
-        }
+        return new Promise((resolve) => {
+          if (window['CustomDB']) {
+            // 清除指定表的所有数据
+            window['CustomDB'].modal
+              .clear()
+              .then(() => {
+                console.log('表数据已成功清除!');
+                resolve(null);
+                window.location.reload();
+              })
+              .catch((error) => {
+                console.error('清除数据时发生错误:', error);
+                resolve(null);
+                window.location.reload();
+              });
+          }
+        });
       }
 
       // 切换部门