fix: 使用 setTimeout 确保画布切换导航生效
This commit is contained in:
parent
0369bc361d
commit
83737c7b9c
@ -64,9 +64,13 @@ export function CanvasFileList({ open, onOpenChange, currentId }: CanvasFileList
|
|||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 先导航,再关闭弹窗(使用 setTimeout 确保导航生效)
|
||||||
|
const targetUrl = `/canvas/${id}`;
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
// 使用完整的 URL 导航确保页面重新加载
|
// 使用 setTimeout 确保在 React 状态更新完成后再导航
|
||||||
window.location.href = `/canvas/${id}`;
|
setTimeout(() => {
|
||||||
|
window.location.assign(targetUrl);
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除画布
|
// 删除画布
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user