修改缓存查询逻辑.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user