feat: 项目上下文支持轻量刷新制作阶段
This commit is contained in:
1 parent
adebc74cf5
commit
ef5325eda3
1 file changed
+8
-1
@@ -18,7 +18,14 @@ export function useProjectData(id: Ref<string>) {
|
||||
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
|
||||
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
|
||||
const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null)
|
||||
return { ...query, project, checkpoints, stageReadiness }
|
||||
/** 子页面完成当前步骤后调用,只刷新轻量项目状态与导航门禁。 */
|
||||
async function refreshStageReadiness() {
|
||||
const projectId = id.value
|
||||
if (!projectId || !query.data.value) return
|
||||
const stageReadiness = await projectsApi.stageReadiness(projectId)
|
||||
if (id.value === projectId && query.data.value) query.data.value = { ...query.data.value, stageReadiness }
|
||||
}
|
||||
return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness }
|
||||
}
|
||||
|
||||
/** 项目布局向子页面提供的类型安全上下文。 */
|
||||
|
||||
Reference in new issue
Block a user