File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,12 @@ export default class Router<Component> extends EventEmitter<IRouterEventMap<Comp
80
80
} ;
81
81
}
82
82
83
- public prepop < T extends IPopNavigationOptions > ( option ?: Partial < T > ) : preActionCallback {
84
- const index = this . routeStack . length - 2 ;
83
+ public prepop < T extends Partial < IPopNavigationOptions > > ( option ?: T ) : preActionCallback {
84
+ let { n = 1 } = option || { } ;
85
+ if ( this . routeStack . length > 1 && n > this . routeStack . length - 1 ) {
86
+ n = this . routeStack . length - 1 ;
87
+ }
88
+ const index = this . routeStack . length - n - 1 ;
85
89
86
90
if ( index < 0 ) {
87
91
return ( cancel ?: boolean ) => undefined ;
@@ -137,10 +141,10 @@ export default class Router<Component> extends EventEmitter<IRouterEventMap<Comp
137
141
* @returns {void }
138
142
* @memberof Router
139
143
*/
140
- public pop < T extends IPopNavigationOptions > ( option : Partial < T > = { } ) : void {
144
+ public pop < T extends Partial < IPopNavigationOptions > > ( option ?: T ) : void {
141
145
if ( this . routeStack . length <= 1 ) return ;
142
- let { n = 1 } = option ;
143
- const { transition } = option ;
146
+ let { n = 1 } = option || { } ;
147
+ const { transition } = option || { } ;
144
148
if ( n > this . routeStack . length - 1 ) {
145
149
n = this . routeStack . length - 1 ;
146
150
}
You can’t perform that action at this time.
0 commit comments