Closed Farnsi closed 8 months ago
Yes, I also thought about that. Although it's not needed often, it can be advantageous to associate an action with whether we moved forward or backward on certain occasions.
I was thinking something similar to this here:
https://github.com/fatihsolhan/v-onboarding/issues/74#issuecomment-1585535236
I would pass an argument to the
beforeStep
andafterStep
functions indicating whether the current step is a "backward" or "forward" step in the sequence. Using this, you can reference it within the function.Now
const step = { on: { beforeStep: () => { /* ... */ }, afterStep: () => { /* ... */ } } }
Feature
const step = { on: { beforeStep: (type?: "forward" | "backward") => { /* ... */ }, afterStep: (type?: "forward" | "backward") => { /* ... */ } } }
The original argument-less function definition,
() => { ... }
, will continue to work. However, if you need to differentiate the logic based on whether it's a forward or backward step, you have the option to do so.
Hi, this is possible after version 2.6.0 thanks to @rozsazoltan https://github.com/fatihsolhan/v-onboarding/pull/83 Docs: https://v-onboarding-docs.fatihsolhan.com/props/hooks
on.beforeStep should get an argument, that indicates if
previous
button was clicked.