添加name记录
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user