Angular使用BraintreePayPalDropin无法触发提交事件
创始人
2024-10-29 12:30:55
0

在使用Braintree PayPal Dropin时,需要在Angular中手动触发提交事件。具体实现方法如下:

  1. 在HTML模板中添加一个按钮,用于触发提交事件。

  1. 在组件中定义submitPayPal()函数,并在该函数中手动触发表单提交事件。

import { Component, ViewChild, ElementRef } from '@angular/core';

@Component({ selector: 'app-payment', templateUrl: './payment.component.html', styleUrls: ['./payment.component.css'] }) export class PaymentComponent { @ViewChild('paypalForm', {static: false}) paypalForm: ElementRef;

submitPayPal() { this.paypalForm.nativeElement.submit(); } }

  1. 在HTML模板中添加一个隐藏的表单,在表单中设置相关参数和回调函数。注意,表单的action需要设置为Braintree的服务器URL。

  1. 在组件中定义相关变量和方法,用于获取相关参数并生成Braintree客户端控件。

import { Component, ViewChild, ElementRef } from '@angular/core';

@Component({ selector: 'app-payment', templateUrl: './payment.component.html', styleUrls: ['./payment.component.css'] }) export class PaymentComponent { @ViewChild('paypalForm', {static: false}) paypalForm: ElementRef; paymentURL = 'https://example.com/payment/process'; // 设置Braintree服务器URL nonce: string; amount: string; orderId: string;

// 生成Braintree客户端控件

相关内容

热门资讯

佛手大菠萝13道挂哪里!hhp... 佛手大菠萝13道挂哪里!hhpoker透视脚本(透视)app-原来教你真的是有挂1、在佛手大菠萝13...
透视揭露!wepoker养号规... 透视揭露!wepoker养号规律(透视)竞技联盟透视插件,教程指引(讲解有挂)-哔哩哔哩1、进入到竞...
wepoker软件靠谱么!竞技... wepoker软件靠谱么!竞技联盟透视(透视)方法-真是曝光是有挂1、不需要AI权限,帮助你快速的进...
透视揭幕!hhpoker有没有... 透视揭幕!hhpoker有没有透视挂(透视)wepoker到底有没有透视,教程秘籍(有挂透视)-哔哩...
hhpoker德州透视!wep... hhpoker德州透视!wepoker俱乐部辅助(透视)插件-一直详情存在有挂1、在wepoker俱...
透视关于!we-poker有人... 透视关于!we-poker有人玩吗(透视)wepoker怎么破解游戏,教程方案(果真有挂)-哔哩哔哩...
悦扑克脚本!wepoker怎么... 悦扑克脚本!wepoker怎么买辅助(透视)工具-果然曝光真的是有挂1、起透看视 wepoker怎么...
透视详细!wepoker买脚本... 透视详细!wepoker买脚本靠谱吗(透视)wpk透视辅助下载,教程手册(有挂解密)-哔哩哔哩1、让...
wepoker怎么设置透视!w... wepoker怎么设置透视!wepoker手机版辅助(透视)技巧-本来开挂真的有挂1、wepoker...
透视开挂!wepoker辅助器... 透视开挂!wepoker辅助器官方(透视)哈糖大菠萝挂法,教程技法(有挂方法)-哔哩哔哩亲,关键说明...