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

相关内容

热门资讯

透视规律"wepok... 透视规律"wepoker买钻石有用吗"详细辅助德州论坛(免费透视脚本攻略);1分钟了解详细教程(微信...
透视脚本"wepok... 透视脚本"wepoker透视破解版"详细辅助玩家教你(辅助软件视频神器);实战中需综合运用上述技巧,...
透视真的"wepok... 透视真的"wepoker轻量版有透视吗"详细辅助AI教程(插件攻略)1、不需要AI权限,帮助你快速的...
透视攻略"wepok... 透视攻略"wepoker有脚本吗"详细辅助扑克教程(透视器免费技巧);玩家必备必赢加哟《136704...
透视私人局"wepo... 透视私人局"wepoker开辅助能查到吗"详细辅助AI教程(透视脚本网页辅助),支持语音通讯、好友开...
透视ai"wepok... 透视ai"wepoker有什么规律"详细辅助必备教程(数据分析工具攻略)是一款可以让一直输的玩家,快...
透视教学"wepok... 透视教学"wepoker安装教程"详细辅助攻略教程(轻量版透视方法辅助)准备好在wepoker安装教...
透视app"wepo... 透视app"wepoker买钻石有用吗"详细辅助科技教程(黑侠辅助器正版下载技巧);大神普及一款德州...
透视好牌"wepok... 此外,数据分析德州(wepoker的辅助器)辅助神器app还具备辅助透视行为开挂功能,通过对客户we...
透视好友房"拱趴大菠... 自定义拱趴大菠萝自动计算机器人系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅助...