chore: 在文档和代码中添加 currentId 属性,增强路由上下文信息

This commit is contained in:
2026-02-23 23:11:37 +08:00
parent 5c24e197e6
commit 0152d15824
2 changed files with 83 additions and 63 deletions

View File

@@ -26,6 +26,10 @@ export type RouteContext<T = { code?: number }, S = any> = {
// 传递状态
state?: S;
// transfer data
/**
* 当前routerId
*/
currentId?: string;
/**
* 当前路径
*/
@@ -314,6 +318,7 @@ export class QueryRouter implements throwError {
const maxNextRoute = this.maxNextRoute;
ctx = (ctx || {}) as RouteContext;
ctx.currentPath = path;
ctx.currentId = route?.id;
ctx.currentKey = key;
ctx.currentRoute = route;
ctx.index = (ctx.index || 0) + 1;