Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

85
Visualizações
VueJs Disable PayPal Button with checkbox

I'm trying to disable the paypal button in VueJs by using JavaScript native So, when the paypal iframe was loaded, i'm trying to do it like this :

methods: {
    async initPaypal() {
      this.$store.dispatch('app/clearMessage')
      this.isLoading = true

      try {
        const { payments } = await paymentService.getPaymentContext(this.group)
        const widgetParameters =
          payments[payments.length - 1]?.additionalDatas?.PAYMENT_WIDGET_INFORMATION.widgetParameters

        if (widgetParameters) {
          this.client = new adeocookie.CookiePgwClient(widgetParameters, 'paypal-container')

          this.client.initialize().then(() => {
            console.log('loaded')
            this.client.render()
            this.isLoading = false
            // to disable button
            const iframe = document.getElementsByTagName('iframe')[0]
            iframe.style.pointerEvents = 'none'
          })

But it doesn't work I've tried to display in console if the iframe was loaded and it's Ok

So, how can i disable this iframe and ideally just the div that contains the button role ?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Rethink what you're doing. With the current PayPal JS SDK, there is no reason to be checking for iframes. If you need to disable the buttons when they are initialized, you can either have their div container start hidden (display:none) by simply coding it to start as such before any button code executes, or instead of hiding use the buttons' own method of actions.disable() (which does not hide) from onInit, as documented in Validate user input.

Here is an example of delayed render with display:none ...

<div id="paypal-button-container"></div>

<script>
   document.querySelector('#paypal-button-container')
     .style.display = 'none';

   paypal.Buttons().render('#paypal-button-container');

   document.querySelector('#myRadioField')
     .addEventListener('click', function() {
       document.querySelector('#paypal-button-container')
         .style.display = 'block';
     });
</script>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda