File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,10 @@ interface Router {
107
107
* updated). Return `false` to cancel the navigation.
108
108
*/
109
109
onBeforePageLoad? : (to : string ) => Awaitable <void | boolean >
110
+ /**
111
+ * Called after the page component is loaded (before the page component is updated).
112
+ */
113
+ onAfterPageLoad? : (to : string ) => Awaitable <void >
110
114
/**
111
115
* Called after the route changes.
112
116
*/
Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ interface Router {
102
102
* 在页面组件加载前(history 状态更新后)调用。返回 `false` 表示取消导航
103
103
*/
104
104
onBeforePageLoad? : (to : string ) => Awaitable <void | boolean >
105
+ /**
106
+ * 在页面组件加载后(页面组件实际更新前)调用
107
+ */
108
+ onAfterPageLoad? : (to : string ) => Awaitable <void >
105
109
/**
106
110
* 在路由更改后调用
107
111
*/
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ export interface Router {
29
29
* updated). Return `false` to cancel the navigation.
30
30
*/
31
31
onBeforePageLoad ?: ( to : string ) => Awaitable < void | boolean >
32
+ /**
33
+ * Called after the page component is loaded (before the page component is updated).
34
+ */
35
+ onAfterPageLoad ?: ( to : string ) => Awaitable < void >
32
36
/**
33
37
* Called after the route changes.
34
38
*/
@@ -94,6 +98,8 @@ export function createRouter(
94
98
throw new Error ( `Invalid route component: ${ comp } ` )
95
99
}
96
100
101
+ await router . onAfterPageLoad ?.( href )
102
+
97
103
route . path = inBrowser ? pendingPath : withBase ( pendingPath )
98
104
route . component = markRaw ( comp )
99
105
route . data = import . meta. env . PROD
You can’t perform that action at this time.
0 commit comments