优化缓存策略.

This commit is contained in:
lijiahangmax
2024-12-29 23:58:44 +08:00
parent 3b89e9bf29
commit c2311f0682
47 changed files with 302 additions and 289 deletions

View File

@@ -17,7 +17,7 @@
<script lang="ts" setup>
import type { SelectOptionData } from '@arco-design/web-vue';
import { computed, onBeforeMount, ref } from 'vue';
import { computed, onActivated, onMounted, ref } from 'vue';
import { useCacheStore } from '@/store';
import { RoleStatus } from '@/views/user/role/types/const';
import { labelFilter } from '@/types/form';
@@ -54,7 +54,7 @@
const optionData = ref<Array<SelectOptionData>>([]);
// 初始化选项
onBeforeMount(async () => {
const initOptions = async () => {
setLoading(true);
try {
const roles = await cacheStore.loadRoles();
@@ -69,7 +69,11 @@
} finally {
setLoading(false);
}
});
};
// 初始化选项
onMounted(initOptions);
onActivated(initOptions);
</script>

View File

@@ -17,7 +17,7 @@
<script lang="ts" setup>
import type { SelectOptionData } from '@arco-design/web-vue';
import { computed, ref, onMounted } from 'vue';
import { computed, ref, onMounted, onActivated } from 'vue';
import { useCacheStore } from '@/store';
import { labelFilter } from '@/types/form';
import useLoading from '@/hooks/loading';
@@ -53,7 +53,7 @@
const optionData = ref<Array<SelectOptionData>>([]);
// 初始化选项
onMounted(async () => {
const initOptions = async () => {
setLoading(true);
try {
// 加载用户列表
@@ -68,7 +68,11 @@
} finally {
setLoading(false);
}
});
};
// 初始化选项
onMounted(initOptions);
onActivated(initOptions);
</script>