Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indicator for previous click #77

Closed
Farnsi opened this issue Jun 12, 2023 · 2 comments
Closed

Add indicator for previous click #77

Farnsi opened this issue Jun 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Farnsi
Copy link

Farnsi commented Jun 12, 2023

on.beforeStep should get an argument, that indicates if previous button was clicked.

@Farnsi Farnsi added the enhancement New feature or request label Jun 12, 2023
@rozsazoltan
Copy link
Contributor

rozsazoltan commented Jun 15, 2023

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:

#74 (comment)

I would pass an argument to the beforeStep and afterStep 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.

@fatihsolhan
Copy link
Owner

Hi, this is possible after version 2.6.0 thanks to @rozsazoltan #83
Docs: https://v-onboarding-docs.fatihsolhan.com/props/hooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants