修改缓存查询逻辑.
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
if (!cacheStore.menus?.length) {
|
||||
// 加载菜单
|
||||
const { data: menuData } = await getMenuList({});
|
||||
cacheStore.updateMenus(menuData);
|
||||
cacheStore.set('menus', menuData);
|
||||
}
|
||||
// 获取角色菜单
|
||||
const { data: roleMenuIdList } = await getRoleMenuId(record.id);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// 卸载时清除 menu cache
|
||||
onUnmounted(() => {
|
||||
const cacheStore = useCacheStore();
|
||||
cacheStore.resetMenus();
|
||||
cacheStore.set('menus', []);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
// 获取全部角色
|
||||
if (!cacheStore.roles?.length) {
|
||||
const { data } = await getRoleList();
|
||||
cacheStore.updateRoles(data);
|
||||
cacheStore.set('roles', data);
|
||||
}
|
||||
// 加载用户角色
|
||||
const { data: roleIdList } = await getUserRoleIdList(formModel.id);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// 卸载时清除 role cache
|
||||
onUnmounted(() => {
|
||||
const cacheStore = useCacheStore();
|
||||
cacheStore.resetRoles();
|
||||
cacheStore.set('roles', []);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user