File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,15 @@ const backCheck = (deltaCount: number, backHid?: string) => {
54
54
const reBack = ( ) => {
55
55
/// 再次返回的时候 设置 重新设置 back id
56
56
setLastBackHookId ( backHid )
57
- setLeaveBefore ( instance )
57
+ setLeaveBefore ( instance , undefined )
58
58
window . history . go ( - deltaCount )
59
59
}
60
60
61
61
const result = hook ( )
62
- if ( typeof result === 'function' ) {
63
- if ( ( await result ( ) ) === true && isSampleBatchId ( ) ) reBack ( )
64
- } else {
62
+ if ( typeof result === 'boolean' ) {
65
63
if ( result && isSampleBatchId ( ) ) reBack ( )
64
+ } else {
65
+ if ( ( await result ) === true && isSampleBatchId ( ) ) reBack ( )
66
66
}
67
67
} )
68
68
}
Original file line number Diff line number Diff line change 9
9
* 在页面即将返回的时候,会调用hook方法,返回是否可以返回
10
10
* 该方法,如果在某个页面多次注册,会覆盖请注意
11
11
*/
12
- const useLeaveBefore = ( hook : ( ) => boolean | ( ( ) => Promise < boolean > ) ) => {
12
+ const useLeaveBefore = ( hook : ( ( ) => boolean ) | ( ( ) => Promise < boolean > ) ) => {
13
13
setValueToAppContext (
14
14
getCurrentInstance ( ) ?. appContext ,
15
15
ExtensionHooks . onLeaveBefore ,
@@ -18,7 +18,7 @@ const useLeaveBefore = (hook: () => boolean | (() => Promise<boolean>)) => {
18
18
}
19
19
20
20
const getLeaveBefore = ( context : AppContext | undefined ) =>
21
- getValueFromAppContext < ( ) => boolean | ( ( ) => Promise < boolean > ) > (
21
+ getValueFromAppContext < ( ( ) => boolean ) | ( ( ) => Promise < boolean > ) > (
22
22
context ,
23
23
ExtensionHooks . onLeaveBefore ,
24
24
)
You can’t perform that action at this time.
0 commit comments