添加点计数功能

This commit is contained in:
wzy-warehouse
2026-05-04 22:29:53 +08:00
parent 5f0fce19d1
commit 4982152f0c
4 changed files with 77 additions and 2 deletions
+14
View File
@@ -35,10 +35,24 @@ export const useLoadingResourceStore = defineStore('loadingResource', () => {
return loadingResource.value[key] || { ids: [], info: [] };
};
/**
* 获取资源数量
* @param key - 资源类型
* @returns 资源数量,如果资源不存在则返回 null
*/
const getResourceCount = (key: LoadingResource): number | null => {
const resource = loadingResource.value[key];
if (!resource) {
return null;
}
return resource.ids.length;
};
return {
loadingResource,
getLoadingResource,
addLoadingResource,
removeLoadingResource,
getResourceCount,
};
});