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

onClick preventDefault is not working in Vue integration #289

Open
1 task
hassanAwanAlvi opened this issue May 9, 2024 · 1 comment
Open
1 task

onClick preventDefault is not working in Vue integration #289

hassanAwanAlvi opened this issue May 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@hassanAwanAlvi
Copy link

hassanAwanAlvi commented May 9, 2024

Describe the bug A clear and concise description of what the bug is.
I am using Vite / Vue and I am trying to preventDefault in google-pay-button's onClick. But I've tried a low of different ways and it seems to have some bug.

To Reproduce Steps to reproduce the behavior:

  1. Install the component in Vue
  2. do @click="(event)=> {event.preventDefault()}"
  3. It will still open the payment sheet.

Expected behavior It should prevent the payment sheet.

Screenshots NA
Component information:

  • Component
    • Custom element (@google-pay/button-element)
      Component version (e.g. 3.1.0):

Environment:

  • Device iMac
  • OS (e.g. 14.2.1 (23C71)):
  • Browser (e.g. Chrome)
  • Country/region: UK

Please don't hesitate to ask me any further questions. Looks like this line has some issues.

const request = this.createLoadPaymentDataRequest(config); try { if (config.onClick) { config.onClick(event); } if (event.defaultPrevented) { return; }

@hassanAwanAlvi hassanAwanAlvi added the bug Something isn't working label May 9, 2024
@dmengelt
Copy link
Member

@hassanAwanAlvi did you check how we do it for our Vue example?

v-bind:clickCallback.prop="onClickPreventDefault"

Like this it works for me and the Google Pay sheet is not shown.

@dmengelt dmengelt self-assigned this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants