添加name记录

This commit is contained in:
wzy-warehouse
2026-04-27 21:36:37 +08:00
parent 4c576132db
commit e47a660590
16 changed files with 57 additions and 40 deletions
+8 -5
View File
@@ -4,12 +4,15 @@ import { ref, type Ref } from 'vue';
// 存储按需加载的数据
export const useLoadingResourceStore = defineStore('loadingResource', () => {
const loadingResource: Ref<Partial<Record<LoadingResource, string[]>>> = ref(
{}
);
const loadingResource: Ref<
Partial<Record<LoadingResource, { ids: string[]; names: string[] }>>
> = ref({});
// 添加数据
const addLoadingResource = (key: LoadingResource, value: string[]) => {
const addLoadingResource = (
key: LoadingResource,
value: { ids: string[]; names: string[] }
) => {
loadingResource.value[key] = value;
};
@@ -24,7 +27,7 @@ export const useLoadingResourceStore = defineStore('loadingResource', () => {
* 获取数据
*/
const getLoadingResource = (key: LoadingResource) => {
return loadingResource.value[key] || [];
return loadingResource.value[key] || { ids: [], names: [] };
};
return {