Typescript 验证码小部件不断消失(启动验证码p-Captcha)
我正在为我的应用程序使用启动验证码。当我通过其他页面路由页面时,它工作正常。但是当我直接加载页面时,验证码不会显示(有时它会显示grecaptcha.render不是控制台中的函数) 如primefaces中所述,我已在index.html中添加了脚本(Typescript 验证码小部件不断消失(启动验证码p-Captcha),typescript,spring-boot,angular6,primeng,Typescript,Spring Boot,Angular6,Primeng,我正在为我的应用程序使用启动验证码。当我通过其他页面路由页面时,它工作正常。但是当我直接加载页面时,验证码不会显示(有时它会显示grecaptcha.render不是控制台中的函数) 如primefaces中所述,我已在index.html中添加了脚本() 另外,我在some-component.html中添加了这个() 我试图显式地呈现它。但还是没有运气。有人能帮我一个例子onLoad函数和在哪里实现。它是否应该在index.html脚本或其他地方实现 index.html <!doct
)
另外,我在some-component.html中添加了这个(
)
我试图显式地呈现它。但还是没有运气。有人能帮我一个例子onLoad函数和在哪里实现。它是否应该在index.html脚本或其他地方实现
index.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Title</title> <base href="/"> <script src="https://www.google.com/recaptcha/api.js?render=explicit&onLoad=initRecaptcha" async defer></script> </head> <body> <app-root></app-root> </body> </html>
让我看看你能更新你问题中的代码吗?不在评论中。让我知道你的启动版本?是否为8.1.1 PRIMENG版本-7.1.0
<div class="p-col-11"> <p-captcha id="captcha" siteKey="sitekey" (onResponse)="storeRecaptchaResponse($event)" #captcha></p-captcha> </div>
storeRecaptchaResponse(event) { this.recaptchaSubmitted = true; this.recaptchaResponse = event.response; console.log('Captcha Response ' + this.recaptchaResponse); }