@esmx/router 3.0.0-rc.13 → 3.0.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,858 @@
1
+ export const StateLayerConfigKey = '__layer_config_key';
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ export type Awaitable<T> = T | PromiseLike<T>;
7
+
8
+ /**
9
+ * HTML5 history state value 支持的类型
10
+ * @description HTML5 history state 不支持所有的数据类型,比如 Symbol Function 类型就是无法写入state 的
11
+ *
12
+ * @internal
13
+ */
14
+ export type HistoryStateValue =
15
+ | string
16
+ | number
17
+ | boolean
18
+ | null
19
+ | undefined
20
+ | HistoryState
21
+ | HistoryStateValue[];
22
+
23
+ /**
24
+ * HTML history.state的数据类型
25
+ */
26
+ export interface HistoryState {
27
+ [x: number]: HistoryStateValue;
28
+ [x: string]: HistoryStateValue;
29
+ }
30
+
31
+ /**
32
+ * 路由的meta配置
33
+ */
34
+ export interface RouteMeta extends Record<string | number | symbol, unknown> {}
35
+
36
+ /**
37
+ * 路由模式
38
+ */
39
+ export enum RouterMode {
40
+ /**
41
+ * hash模式
42
+ * 按 Hanson 要求,不支持hash模式
43
+ */
44
+ // HASH = 'hash',
45
+
46
+ /**
47
+ * history模式
48
+ * @description 客户端默认使用 history 模式
49
+ */
50
+ HISTORY = 'history',
51
+
52
+ /**
53
+ * 虚拟路由模式
54
+ * @description 此模式不存在历史记录,服务端默认使用 abstract 模式
55
+ */
56
+ ABSTRACT = 'abstract'
57
+ }
58
+
59
+ /**
60
+ * 路由重定向配置的类型
61
+ */
62
+ export type RouteRedirect =
63
+ | RouterRawLocation
64
+ | ((to: RouteRecord) => RouterRawLocation);
65
+
66
+ /**
67
+ * 路由守卫返回值
68
+ */
69
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
70
+ export type NavigationGuardReturn = boolean | RouterRawLocation | void;
71
+
72
+ /**
73
+ * 路由守卫钩子
74
+ */
75
+ export type NavigationGuard = (
76
+ from: RouteRecord,
77
+ to: RouteRecord
78
+ ) => Awaitable<NavigationGuardReturn>;
79
+
80
+ /**
81
+ * 路由守卫afterEach钩子
82
+ */
83
+ export type NavigationGuardAfter = (from: RouteRecord, to: RouteRecord) => any;
84
+
85
+ /**
86
+ * 路由配置使用的 route
87
+ */
88
+ export interface RouteConfig {
89
+ /**
90
+ * 应用类型, 只在根路由配置有效
91
+ */
92
+ appType?: string;
93
+
94
+ /**
95
+ * 按 Hanson 要求,不提供 name 功能
96
+ */
97
+ // name: string;
98
+
99
+ /**
100
+ * 路径
101
+ * 在配置path为数组类型时,会根据配置的数组生成多个匹配规则,在命中任意一个匹配规则时,会重定向到配置的第一个 path
102
+ * 按 Hanson 要求,只支持相对路径
103
+ * 路径配置请参考文档: https://github.com/pillarjs/path-to-regexp/tree/v6.2.2#parameters
104
+ */
105
+ path: string | string[];
106
+
107
+ /**
108
+ * 路由配置的组件
109
+ */
110
+ component?: any;
111
+
112
+ /**
113
+ * 路由配置的异步组件
114
+ */
115
+ asyncComponent?: () => any;
116
+
117
+ /**
118
+ * 路由命中时的重定向地址
119
+ */
120
+ redirect?: RouteRedirect;
121
+
122
+ /**
123
+ * 路由元信息
124
+ */
125
+ meta?: RouteMeta;
126
+
127
+ /**
128
+ * 子路由配置
129
+ */
130
+ children?: RouteConfig[];
131
+
132
+ /**
133
+ * 进入路由前的路由守卫
134
+ */
135
+ beforeEnter?: NavigationGuard;
136
+
137
+ /**
138
+ * 更新路由前的路由守卫
139
+ */
140
+ beforeUpdate?: NavigationGuard;
141
+
142
+ /**
143
+ * 离开路由前的路由守卫
144
+ */
145
+ beforeLeave?: NavigationGuard;
146
+ }
147
+
148
+ /**
149
+ * 路由前置部分
150
+ * 例: https://www.google.com:443/en/news/123
151
+ * 客户端传入 https://www.google.com:443/en https://www.google.com:443/en/
152
+ * 服务端传入 https://www.google.com:443/en https://www.google.com:443/en/
153
+ */
154
+ export type RouterBase =
155
+ | string
156
+ | ((params: {
157
+ fullPath: string;
158
+ /**
159
+ * 按 Hanson 要求加入 undefined 类型
160
+ */
161
+ query: Record<string, string | undefined>;
162
+ queryArray: Record<string, string[]>;
163
+ hash: string;
164
+ }) => string);
165
+
166
+ /**
167
+ * Scroll position 与 {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`} 相似.
168
+ * 注意并不是所有浏览器都支持`behavior`属性.
169
+ */
170
+ export interface ScrollPositionCoordinates {
171
+ behavior?: ScrollOptions['behavior'];
172
+ left?: number;
173
+ top?: number;
174
+ }
175
+
176
+ /**
177
+ * 内部使用的 {@link ScrollPositionCoordinates} `left` 和 `top` 属性始终有值.
178
+ * 必须是 HistoryStateValue 支持的类型.
179
+ * @internal
180
+ */
181
+ export interface _ScrollPositionNormalized {
182
+ behavior?: ScrollOptions['behavior'];
183
+ left: number;
184
+ top: number;
185
+ }
186
+
187
+ export interface ScrollPositionElement extends ScrollToOptions {
188
+ /**
189
+ * 一个合法的 CSS 选择器. 部分特殊字符需要被转义 (https://mathiasbynens.be/notes/css-escapes).
190
+ * @example
191
+ * 这里是部分示例:
192
+ *
193
+ * - `.title`
194
+ * - `.content:first-child`
195
+ * - `#marker`
196
+ * - `#marker\~with\~symbols`
197
+ * - `#marker.with.dot`: 选中的是 `class="with dot" id="marker"`, 而不是 `id="marker.with.dot"`
198
+ *
199
+ */
200
+ el: string | Element;
201
+ }
202
+
203
+ /**
204
+ * 滚动行为处理器类型
205
+ */
206
+ export type ScrollBehaviorHandler<T> = (
207
+ to: RouteRecord,
208
+ from: RouteRecord,
209
+ savedPosition: T | undefined
210
+ ) => Awaitable<ScrollPosition | false | undefined>;
211
+
212
+ /**
213
+ * 滚动参数
214
+ */
215
+ export type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
216
+
217
+ /**
218
+ * @param to - 前往的路由
219
+ * @param from - 离开的路由
220
+ * @param savedPosition - 存储的位置,如果不存在则为 null
221
+ */
222
+ export type RouterScrollBehavior = (
223
+ to: RouteRecord,
224
+ from: RouteRecord,
225
+ savedPosition: ScrollPosition | null
226
+ ) => Awaitable<ScrollPosition | false | undefined>;
227
+
228
+ /**
229
+ * 路由配置
230
+ */
231
+ export interface RouterOptions {
232
+ /**
233
+ * 路由模式
234
+ */
235
+ mode?: RouterMode;
236
+
237
+ /**
238
+ * 路由前置部分
239
+ * 例: https://www.google.com:443/en/news/123
240
+ * 客户端传入 en /en /en/ 均可
241
+ * 服务端传入 https://www.google.com:443/en https://www.google.com:443/en/
242
+ */
243
+ base?: RouterBase;
244
+
245
+ /**
246
+ * 初始化时使用的初始 url
247
+ */
248
+ initUrl?: string;
249
+
250
+ /**
251
+ * 滚动行为配置
252
+ */
253
+ scrollBehavior?: RouterScrollBehavior;
254
+
255
+ /**
256
+ * 类似 vue nextTick 等待下一次 DOM 更新刷新的工具方法
257
+ */
258
+ nextTick?: () => Awaitable<any>;
259
+
260
+ /**
261
+ * 到达历史记录末点时触发 history back 之后的回调
262
+ * @description 只有在 history state 可用的环境才生效
263
+ */
264
+ noBackNavigation?: (router: RouterInstance) => void;
265
+
266
+ /**
267
+ * 判断是否是外部链接。在同域时调用,用于处理同域也被视为外站的情况
268
+ * @param router 路由实例
269
+ * @param url 要判断的链接
270
+ * @param route 虚假的 route 信息
271
+ * @returns 是否是外部链接,返回 `false | undefined` 会继续路由跳转(`true` 会调用 `handleOutside`)。
272
+ */
273
+ validateOutside?: (context: {
274
+ router: RouterInstance;
275
+ location: RouterRawLocation;
276
+ route: Route;
277
+ }) => boolean | undefined;
278
+
279
+ /**
280
+ * 路由跳转到外部链接时触发
281
+ * @param router 路由实例
282
+ * @param route 虚假的 route 信息
283
+ * @param replace 是否替换当前历史记录
284
+ * @param isTriggerWithWindow 是否是 pushWindow/replaceWindow 触发的
285
+ * @param isSameHost 是否是同域。
286
+ * * 客户端如果 `isTriggerWithWindow === true && isSameHost === true`,意味着 `validateOutside` 返回了 `true`
287
+ * * 服务端如果 `isSameHost === true`,意味着 `validateOutside` 返回了 `true`
288
+ * @returns 返回 `false` 认为使用者已自行处理跳转行为,不会继续默认的路由跳转逻辑
289
+ */
290
+ handleOutside?: (context: {
291
+ router: RouterInstance;
292
+ route: Route;
293
+ replace: boolean;
294
+ isTriggerWithWindow: boolean;
295
+ isSameHost: boolean;
296
+ }) => boolean | undefined;
297
+
298
+ /**
299
+ * 路由配置使用的 route
300
+ */
301
+ routes: RouteConfig[];
302
+ }
303
+
304
+ /**
305
+ * 用户使用的 route
306
+ */
307
+ export interface Route {
308
+ hash: URL['hash'];
309
+ host: URL['host'];
310
+ hostname: URL['hostname'];
311
+ href: URL['href'];
312
+ origin: URL['origin'];
313
+ pathname: URL['pathname'];
314
+ port: URL['port'];
315
+ protocol: URL['protocol'];
316
+ search: URL['search'];
317
+
318
+ params: Record<string, string>;
319
+ /**
320
+ * 按 Hanson 要求加入 undefined 类型
321
+ */
322
+ query: Record<string, string | undefined>;
323
+ /**
324
+ * 按 Hanson 要求加入 undefined 类型
325
+ */
326
+ queryArray: Record<string, string[] | undefined>;
327
+ state: HistoryState;
328
+ meta: RouteMeta;
329
+ path: string;
330
+ fullPath: string;
331
+ base: string;
332
+ matched: RouteConfig[];
333
+ }
334
+
335
+ /**
336
+ * 路由记录
337
+ */
338
+ export interface RouteRecord {
339
+ base: string;
340
+ /**
341
+ * 路径
342
+ */
343
+ path: string;
344
+
345
+ fullPath: string;
346
+ params: Record<string, string>;
347
+ /**
348
+ * 按 Hanson 要求加入 undefined 类型
349
+ */
350
+ query: Record<string, string | undefined>;
351
+ /**
352
+ * 按 Hanson 要求加入 undefined 类型
353
+ */
354
+ queryArray: Record<string, string[] | undefined>;
355
+ hash: string;
356
+ state: HistoryState;
357
+
358
+ /**
359
+ * 路由配置的组件
360
+ */
361
+ component?: any;
362
+
363
+ /**
364
+ * 路由配置的异步组件
365
+ */
366
+ asyncComponent?: () => any;
367
+
368
+ /**
369
+ * 路由元信息
370
+ */
371
+ meta: RouteMeta;
372
+
373
+ /**
374
+ * 重定向配置
375
+ */
376
+ redirect?: RouteRedirect;
377
+
378
+ /**
379
+ * 匹配的路由
380
+ */
381
+ matched: RouteConfig[];
382
+
383
+ /**
384
+ * 重定向来源
385
+ */
386
+ redirectedFrom?: RouteRecord;
387
+
388
+ /**
389
+ * 来源
390
+ */
391
+ from?: RouteRecord;
392
+ }
393
+
394
+ /**
395
+ * 路由历史
396
+ */
397
+ export interface RouterHistory {
398
+ /**
399
+ * 路由实例
400
+ */
401
+ readonly router: RouterInstance;
402
+
403
+ /**
404
+ * 路由是否被冻结
405
+ * @description 路由实例被冻结后,路由实例的所有方法都将失效
406
+ */
407
+ isFrozen: boolean;
408
+
409
+ /**
410
+ * 匹配的当前路由
411
+ */
412
+ readonly current: RouteRecord;
413
+
414
+ /**
415
+ * 解析路由
416
+ */
417
+ resolve: (location: RouterRawLocation) => RouteRecord;
418
+
419
+ /**
420
+ * 更新路由
421
+ */
422
+ updateRoute: (route: RouteRecord) => void;
423
+
424
+ /**
425
+ * 跳转方法,会创建新的历史纪录
426
+ */
427
+ push: (location: RouterRawLocation) => Promise<void>;
428
+
429
+ /**
430
+ * 跳转方法,替换当前历史记录
431
+ */
432
+ replace: (location: RouterRawLocation) => Promise<void>;
433
+
434
+ /**
435
+ * 新开浏览器窗口的方法,在服务端会调用 push 作为替代
436
+ */
437
+ pushWindow: (location: RouterRawLocation) => void;
438
+
439
+ /**
440
+ * 替换当前浏览器窗口的方法,在服务端会调用 replace 作为替代
441
+ */
442
+ replaceWindow: (location: RouterRawLocation) => void;
443
+
444
+ /**
445
+ * 路由移动到指定历史记录方法
446
+ */
447
+ go: (delta: number) => void;
448
+
449
+ /**
450
+ * 路由历史记录前进方法
451
+ */
452
+ forward: () => void;
453
+
454
+ /**
455
+ * 路由历史记录后退方法
456
+ */
457
+ back: () => void;
458
+
459
+ /**
460
+ * 初始化方法
461
+ */
462
+ init: (params?: { replace?: boolean }) => Promise<void>;
463
+
464
+ /**
465
+ * 卸载方法
466
+ */
467
+ destroy: () => void;
468
+ }
469
+
470
+ /**
471
+ * 路由跳转等事件使用的参数
472
+ */
473
+ export interface RouterLocation {
474
+ path?: string;
475
+ /**
476
+ * 按 Hanson 要求加入 undefined 类型
477
+ */
478
+ query?: Record<string, string | undefined>;
479
+ queryArray?: Record<string, string[]>;
480
+ params?: Record<string, string>;
481
+ hash?: string;
482
+ state?: HistoryState;
483
+ }
484
+
485
+ /**
486
+ * 路由跳转等事件使用的参数
487
+ */
488
+ export type RouterRawLocation =
489
+ | (RouterLocation & {
490
+ /**
491
+ * 设置此参数后,不保存滚动位置,跳转后页面位置仍在原处
492
+ */
493
+ keepScrollPosition?: boolean;
494
+ })
495
+ | string;
496
+
497
+ /**
498
+ * 路由匹配规则
499
+ */
500
+ export interface RouteMatch {
501
+ /**
502
+ * 路径匹配的正则表达式
503
+ */
504
+ regex: RegExp;
505
+
506
+ /**
507
+ * 路由匹配方法,返回值意味着传入的路径是否匹配此路由
508
+ */
509
+ match: (path: string) => boolean;
510
+
511
+ /**
512
+ * 路径解析方法
513
+ */
514
+ parse: (path: string) => {
515
+ params: Record<string, string>;
516
+ query: Record<string, string | undefined>;
517
+ queryArray: Record<string, string[]>;
518
+ hash: string;
519
+ };
520
+
521
+ /**
522
+ * 按照传入参数解析出完整路径
523
+ */
524
+ compile: (params?: {
525
+ params?: Record<string, string>;
526
+ query?: Record<string, string | undefined>;
527
+ queryArray?: Record<string, string[]>;
528
+ hash?: string;
529
+ }) => string;
530
+
531
+ /**
532
+ * 路径
533
+ */
534
+ path: string;
535
+
536
+ /**
537
+ * 应用类型
538
+ */
539
+ appType: string;
540
+
541
+ /**
542
+ * 路由配置的组件
543
+ */
544
+ component?: any;
545
+
546
+ /**
547
+ * 路由配置的异步组件
548
+ */
549
+ asyncComponent?: () => any | Promise<any>;
550
+
551
+ /**
552
+ * 父路由
553
+ */
554
+ parent?: RouteMatch;
555
+
556
+ /**
557
+ * 路由元信息
558
+ */
559
+ meta: RouteMeta;
560
+
561
+ /**
562
+ * 重定向配置
563
+ */
564
+ redirect?: RouteRedirect;
565
+
566
+ /**
567
+ * 内部重定向,当 path 配置为数组时生成的内部重定向配置
568
+ */
569
+ internalRedirect?: RouteMatch;
570
+
571
+ /**
572
+ * 匹配的路由
573
+ */
574
+ matched: RouteConfig[];
575
+ }
576
+
577
+ /**
578
+ * 路由匹配器
579
+ */
580
+ export interface RouterMatcher {
581
+ /**
582
+ * 路由匹配方法
583
+ */
584
+ match: (
585
+ raw: RouterLocation,
586
+ config?: { base: string }
587
+ ) => RouteRecord | null;
588
+
589
+ /**
590
+ * 新增单个路由匹配规则
591
+ */
592
+ // addRoute: (route: RouteConfig) => void;
593
+
594
+ /**
595
+ * 新增多个路由匹配规则
596
+ */
597
+ // addRoutes: (routes: RouteConfig[]) => void;
598
+
599
+ /**
600
+ * 获取所有路由匹配规则
601
+ */
602
+ getRoutes: () => RouteMatch[];
603
+ }
604
+
605
+ /**
606
+ * 路由注册配置
607
+ */
608
+ export type RegisteredConfigMap = Record<
609
+ string,
610
+ {
611
+ mounted: boolean;
612
+ generator: (router: RouterInstance) => RegisteredConfig;
613
+ config?: RegisteredConfig;
614
+ }
615
+ >;
616
+
617
+ export interface RouterInitOptions {
618
+ parent?: RouterInstance;
619
+ route?: RouteRecord;
620
+ replace?: boolean;
621
+ }
622
+
623
+ /**
624
+ * 路由注册配置
625
+ */
626
+ export interface RegisteredConfig {
627
+ /**
628
+ * 初始化
629
+ */
630
+ mount: () => any;
631
+
632
+ /**
633
+ * 更新
634
+ */
635
+ updated: () => any;
636
+
637
+ /**
638
+ * 销毁
639
+ */
640
+ destroy: () => any;
641
+ }
642
+
643
+ /**
644
+ * 路由类实例
645
+ */
646
+ export interface RouterInstance {
647
+ /**
648
+ * 当前路由对象的上级路由对象
649
+ */
650
+ parent: RouterInstance | null;
651
+
652
+ /**
653
+ * 路由是否冻结
654
+ */
655
+ isFrozen: boolean;
656
+
657
+ /**
658
+ * 路由冻结方法
659
+ */
660
+ freeze: () => void;
661
+
662
+ /**
663
+ * 路由解冻方法
664
+ */
665
+ unfreeze: () => void;
666
+
667
+ /**
668
+ * 路由配置
669
+ */
670
+ options: RouterOptions;
671
+
672
+ /**
673
+ * 路由固定前置路径
674
+ * 需要注意的是如果使用函数返回 base,需要尽量保证相同的路径返回相同base
675
+ */
676
+ base?: RouterBase;
677
+
678
+ /**
679
+ * 滚动行为
680
+ */
681
+ scrollBehavior: RouterScrollBehavior;
682
+
683
+ /**
684
+ * 路由模式
685
+ */
686
+ mode: RouterMode;
687
+
688
+ /**
689
+ * 路由匹配器
690
+ */
691
+ matcher: RouterMatcher;
692
+
693
+ /**
694
+ * 路由history类
695
+ */
696
+ history: RouterHistory;
697
+
698
+ /**
699
+ * 当前路由信息
700
+ */
701
+ route: Route;
702
+
703
+ /**
704
+ * 解析路由
705
+ */
706
+ resolve: (location: RouterRawLocation) => RouteRecord;
707
+
708
+ /**
709
+ * 更新路由
710
+ */
711
+ updateRoute: (route: RouteRecord) => void;
712
+
713
+ /**
714
+ * 初始化
715
+ */
716
+ init: (options?: RouterInitOptions) => Promise<void>;
717
+
718
+ /**
719
+ * 卸载方法
720
+ */
721
+ destroy: () => void;
722
+
723
+ /**
724
+ * app配置注册
725
+ */
726
+ register: (
727
+ name: string,
728
+ config: (router: RouterInstance) => RegisteredConfig
729
+ ) => void;
730
+
731
+ /* 已注册的app配置 */
732
+ registeredConfigMap: RegisteredConfigMap;
733
+
734
+ /**
735
+ * 全局路由守卫
736
+ */
737
+ readonly guards: {
738
+ beforeEach: NavigationGuard[];
739
+ afterEach: NavigationGuardAfter[];
740
+ };
741
+
742
+ /**
743
+ * 注册全局路由前置守卫
744
+ */
745
+ beforeEach: (guard: NavigationGuard) => void;
746
+
747
+ /**
748
+ * 卸载全局路由前置守卫
749
+ */
750
+ unBindBeforeEach: (guard: NavigationGuard) => void;
751
+
752
+ /**
753
+ * 注册全局路由后置守卫
754
+ */
755
+ afterEach: (guard: NavigationGuardAfter) => void;
756
+
757
+ /**
758
+ * 卸载全局路由后置守卫
759
+ */
760
+ unBindAfterEach: (guard: NavigationGuardAfter) => void;
761
+
762
+ /**
763
+ * 路由跳转方法,会创建新的历史记录
764
+ */
765
+ push: (location: RouterRawLocation) => Promise<void>;
766
+
767
+ /**
768
+ * 路由跳转方法,会替换当前的历史记录
769
+ */
770
+ replace: (location: RouterRawLocation) => Promise<void>;
771
+
772
+ /**
773
+ * 当前路由弹层id,用于区分不同的路由弹层
774
+ */
775
+ layerId: number;
776
+
777
+ /**
778
+ * 路由弹层配置
779
+ */
780
+ layerConfigList: Array<{
781
+ /**
782
+ * 路由弹层id
783
+ */
784
+ id: number;
785
+ /**
786
+ * 路由弹层深度
787
+ */
788
+ depth: number;
789
+ }>;
790
+
791
+ /**
792
+ * 路由弹层id与路由实例的map
793
+ */
794
+ layerMap: Record<
795
+ number,
796
+ {
797
+ router: RouterInstance;
798
+ config: RegisteredConfig;
799
+ destroyed: boolean;
800
+ }
801
+ >;
802
+
803
+ /**
804
+ * 更新路由弹层方法
805
+ */
806
+ updateLayerState: (route: RouteRecord) => void;
807
+
808
+ /**
809
+ * 检查路由弹层方法
810
+ */
811
+ checkLayerState: (state: HistoryState) => boolean;
812
+
813
+ /**
814
+ * 打开路由弹层方法,会创建新的路由实例并调用注册的 register 方法
815
+ * 服务端会使用 push 作为替代
816
+ */
817
+ pushLayer: (location: RouterRawLocation) => void;
818
+
819
+ /**
820
+ * 新开浏览器窗口的方法, 会进入配置的 handleOutside 钩子,在服务端会调用 push 作为替代
821
+ */
822
+ pushWindow: (location: RouterRawLocation) => void;
823
+
824
+ /**
825
+ * 替换当前浏览器窗口的方法,在服务端会调用 replace 作为替代
826
+ */
827
+ replaceWindow: (location: RouterRawLocation) => void;
828
+
829
+ /**
830
+ * 前往特定路由历史记录的方法,可以在历史记录前后移动
831
+ */
832
+ go: (delta: number) => void;
833
+
834
+ /**
835
+ * 路由历史记录前进方法
836
+ */
837
+ forward: () => void;
838
+
839
+ /**
840
+ * 路由历史记录后退方法
841
+ */
842
+ back: () => void;
843
+
844
+ /**
845
+ * 新增单个路由匹配规则
846
+ */
847
+ // addRoute: (route: RouteConfig) => void;
848
+
849
+ /**
850
+ * 新增多个路由匹配规则
851
+ */
852
+ // addRoutes: (routes: RouteConfig[]) => void;
853
+
854
+ /**
855
+ * 根据获取当前所有活跃的路由Record对象
856
+ */
857
+ getRoutes: () => RouteMatch[];
858
+ }