Skip to content

Commit

Permalink
fix(taro-router): 修复函数式组件中leave hook的问题 (#5888)
Browse files Browse the repository at this point in the history
Co-authored-by: ganzhanjian <ganzhanjian@mucfc.com>
  • Loading branch information
jackie-gan and ganzhanjian authored Apr 3, 2020
1 parent 59fe68a commit 6873a92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/taro-router/src/history/createHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const createHistory = (props: { basename?: string, mode: "hash" | "browser" | "m
}

function getUserConfirmation(next: Callback, fromLocation: Location, toLocation: Location): void {
const currentRoute = getCurrentRoute()
const currentRoute = getCurrentRoute() || {}
const leaveHook = currentRoute.beforeRouteLeave

if (typeof leaveHook === 'function') {
Expand Down

0 comments on commit 6873a92

Please sign in to comment.