chore: 在文档和代码中添加 currentId 属性,增强路由上下文信息
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user