修改缓存查询逻辑.

This commit is contained in:
lijiahang
2023-09-14 12:07:33 +08:00
parent 2ff0d37f07
commit 08f9b9410b
9 changed files with 25 additions and 43 deletions

View File

@@ -260,7 +260,7 @@
setFetchLoading(true);
const { data } = await getMenuList(formModel);
tableRenderData.value = data as MenuQueryResponse[];
cacheStore.updateMenus(tableRenderData.value);
cacheStore.set('menus', tableRenderData.value);
} finally {
setFetchLoading(false);
}
@@ -301,11 +301,6 @@
await loadMenuData();
};
// 卸载时清除 menu cache
onUnmounted(() => {
cacheStore.resetMenus();
});
</script>
<style lang="less" scoped>

View File

@@ -21,9 +21,16 @@
import MenuTable from '@/views/system/menu/components/menu-table.vue';
import MenuFormModal from '@/views/system/menu/components/menu-form-modal.vue';
import { ref } from 'vue';
import { onUnmounted, ref } from 'vue';
import { useCacheStore } from '@/store';
const table = ref<any>();
const modal = ref<any>();
// 卸载时清除 menu cache
onUnmounted(() => {
const cacheStore = useCacheStore();
cacheStore.set('menus', []);
});
</script>