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客户端控件

相关内容

热门资讯

透视演示!hhpoker辅助软... 透视演示!hhpoker辅助软件是真的么(WePoKer俱乐部)总是有辅助神器(哔哩哔哩)1、hhp...
透视操作!德州私人局怎么透视(... 透视操作!德州私人局怎么透视(AApoker插件)好像是有辅助软件(哔哩哔哩)1.德州私人局怎么透视...
透视练习!wpk俱乐部怎么作必... 透视练习!wpk俱乐部怎么作必弊(WePoKer钻石)好像真的是有辅助攻略(哔哩哔哩)wpk俱乐部怎...
透视技法!菠萝辅助器免费版的特... 透视技法!菠萝辅助器免费版的特点(HHpoker透视挂)一贯有辅助方法(哔哩哔哩)1)菠萝辅助器免费...
透视课程!hhpoker辅助挂... 透视课程!hhpoker辅助挂(WPK模拟器)果然存在有辅助教程(哔哩哔哩)hhpoker辅助挂破解...
透视手筋!hh poker软件... 透视手筋!hh poker软件(AApoker设置)切实是真的有辅助插件(哔哩哔哩)hh poker...
透视法门!wepoker辅助软... 透视法门!wepoker辅助软件价格(WPK有透视)切实是有辅助方法(哔哩哔哩)1、不需要AI权限,...
透视机巧!有没有人wepoke... 透视机巧!有没有人wepoker(AApoker辅助器)好像有辅助方法(哔哩哔哩)1、进入游戏-大厅...
透视技法!wepoker有用吗... 透视技法!wepoker有用吗(AApoker控制牌)都是是真的有辅助神器(哔哩哔哩)1、超多福利:...
透视要领!智星菠萝辅助(HHp... 透视要领!智星菠萝辅助(HHpoker教程)竟然有辅助技巧(哔哩哔哩)该软件可以轻松地帮助玩家将智星...