Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带有';这';_Javascript_Callback_Recaptcha_Invisible Recaptcha - Fatal编程技术网

Javascript 带有';这';

Javascript 带有';这';,javascript,callback,recaptcha,invisible-recaptcha,Javascript,Callback,Recaptcha,Invisible Recaptcha,我自己手动调用回调函数有困难,因为其中有this。我不太擅长JS,这是我在JS中唯一要做的事情。有没有一种简单的方法来调用该函数 }),i.createElement(“div”{ id:“recaptcha元素容器”, 类名:t })) },t.prototype.reset=函数(){ null!==this.state.widgetId&&window.grecaptcha&&window.grecaptcha.reset(this.state.widgetId) },t.prototyp

我自己手动调用回调函数有困难,因为其中有
this
。我不太擅长JS,这是我在JS中唯一要做的事情。有没有一种简单的方法来调用该函数

}),i.createElement(“div”{
id:“recaptcha元素容器”,
类名:t
}))
},t.prototype.reset=函数(){
null!==this.state.widgetId&&window.grecaptcha&&window.grecaptcha.reset(this.state.widgetId)
},t.prototype.execute=function(){
null!==this.state.widgetId&&window.grecaptcha&&this.props.invisible&&window.grecaptcha.execute(this.state.widgetId)
},t.prototype.initRecaptcha=函数(){
如果(window.grecaptcha){
var e=window.grecaptcha.render(“recaptcha元素容器”{
sitekey:this.props.invisible?c.p.config.invisibleCaptchaKey:c.p.config.captchaKey,
回调:this.onChange,
主题:“光”,
键入:“图像”,
大小:this.props.invisible?“invisible”:“normal”,
索引:0,
这个.props.languageCode,
徽章:“右下角”,
“过期回调”:this.onExpired
});
这是我的国家({
widgetId:e
})
}
},t

正在回调的函数,将其更改为窗口。为了指定什么是“this”,您可以使用此处全面描述的“bind”:

或者这个=那个模式

如果使用ECMA6及以上版本,则使用箭头函数将为您提供“this”下的预期变量


使用代码段时,请粘贴到正确的窗格中。更可取的做法是发布一个回调,特别是你在谈论哪个回调?我不认为我们可以显式调用回调,因为它们的执行完全取决于它之前的一些其他条件。我想我想调用“回调:this.onChange”基本上,我想验证用户recaptcha input@BergiIt不清楚这是从哪里来的
。onChange
,但您可能可以使用副本中的任何方法来解决这一问题