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

相关内容

热门资讯

科技新动态!wepoker新号... 1、科技新动态!wepoker新号好一点吗,wepokerplus作弊,微扑克教程(有挂透明)2、进...
推荐一款!aapoker透视怎... 推荐一款!aapoker透视怎么用,约局吧怎么看有没有挂,透明挂教程(有挂技巧)1、很好的工具软件,...
新手必备!wepoker透视版... 您好,wepoker透视版下载这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很...
玩家必看秘籍!pokemmo辅... 玩家必看秘籍!pokemmo辅助脚本,pokemmo脚本辅助器下载,必胜教程(有挂透明)科技教程也叫...
新手必备!约局吧app有挂吗,... 新手必备!约局吧app有挂吗,aa poker辅助,可靠技巧(有挂教程)是一款可以让一直输的玩家,快...
推荐攻略!aapoker脚本怎... 推荐攻略!aapoker脚本怎么用,德普辅助软件,详细教程(有挂方法)这是由厦门游乐互动科技有限公司...
分享个大家!we-poker靠... 此外,数据分析德州(we-poker靠谱吗)辅助神器app还具备辅助透视行为开挂功能,通过对客户we...
玩家必看秘籍!pokemmo辅... 玩家必看秘籍!pokemmo辅助器脚本下载,aa poker透视软件,揭秘教程(有挂技巧);玩家必备...
分享认知!wepoker手机插... 分享认知!wepoker手机插件,poker红龙辅助,必胜教程(有挂技巧)准备好在wepoker手机...
玩家必备科普!hh poker... 玩家必备科普!hh poker辅助有用吗,hhpoker开挂教程,透明挂教程(有挂技巧);最新版20...