Skip to content

Commit

Permalink
fix(guards): vue-class-component call guards on first... (#755)
Browse files Browse the repository at this point in the history
navigation with lazy routes
  • Loading branch information
yuangongji committed Feb 4, 2021
1 parent 04fee14 commit 06f942d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/navigationGuards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ export function extractComponentsGuards(
: resolved
// replace the function with the resolved component
record.components[name] = resolvedComponent
// @ts-ignore: the options types are not propagated to Component
const guard: NavigationGuard = resolvedComponent[guardType]
// __vccOpts is added by vue-class-component and contain the regular options
let options: ComponentOptions =
(resolvedComponent as any).__vccOpts || resolvedComponent
const guard = options[guardType]
return guard && guardToPromiseFn(guard, to, from, record, name)()
})
)
Expand Down

0 comments on commit 06f942d

Please sign in to comment.