Skip to content

Commit

Permalink
fix: separate index and step settings for before and after hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsazoltan committed Sep 24, 2023
1 parent 697e2f3 commit 66a94c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/VOnboardingWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export default defineComponent({
watch(index, async (newIndex, oldIndex) => {
const direction: number = newIndex < oldIndex ? Direction.BACKWARD : Direction.FORWARD
const globalHookOptions = {
index: privateIndex.value,
step: activeStep.value,
direction: direction,
isForward: direction === Direction.FORWARD,
isBackward: direction === Direction.BACKWARD,
Expand All @@ -55,6 +53,8 @@ export default defineComponent({
const afterHookOptions: onAfterStepOptions = {
...globalHookOptions,
// custom afterHookOptions here
index: oldIndex,
step: oldStep,
}
await afterHook(oldStep, afterHookOptions)
}
Expand All @@ -63,6 +63,8 @@ export default defineComponent({
const beforeHookOptions: onBeforeStepOptions = {
...globalHookOptions,
// custom afterHookOptions here
index: newIndex,
step: newStep,
}
await beforeHook(newStep, beforeHookOptions)
}
Expand Down

0 comments on commit 66a94c0

Please sign in to comment.