diff --git a/packages/ui/certd-client/src/store/project/index.ts b/packages/ui/certd-client/src/store/project/index.ts index 09c1bb967..1122c9b9c 100644 --- a/packages/ui/certd-client/src/store/project/index.ts +++ b/packages/ui/certd-client/src/store/project/index.ts @@ -15,11 +15,18 @@ export type ProjectItem = { export const useProjectStore = defineStore("app.project", () => { const myProjects = ref([]); const inited = ref(false); + const currentProjectId = ref(); // 直接调用 + + function $reset() { + myProjects.value = []; + currentProjectId.value = ""; + inited.value = false; + } const userStore = useUserStore(); const userId = userStore.getUserInfo?.id; const lastProjectIdCacheKey = "currentProjectId:" + userId; const lastProjectId = LocalStorage.get(lastProjectIdCacheKey); - const currentProjectId = ref(lastProjectId); // 直接调用 + currentProjectId.value = lastProjectId; const projects = computed(() => { return myProjects.value; @@ -118,11 +125,6 @@ export const useProjectStore = defineStore("app.project", () => { return false; } - function $reset() { - myProjects.value = []; - currentProjectId.value = ""; - } - return { projects, myProjects,