![](/img/trans.png)
[英]react-google-recaptcha : Setting window attributes in React-Redux
[英]How to enable enter button in react-google-recaptcha after captcha verfication?
我需要在驗證碼驗證后激活輸入按鈕,但目前它不起作用。 它顯示了anchor:1 Uncaught (in promise) null
下面是我的全部代碼。 我正在使用https://www.npmjs.com/package/react-google-recaptcha
enterkey = event => {
console.log(event)
if (event.key === "Enter") {
this.submitHandler(event);
}
};
captchaValidate = (value) => {
this.enterkey();
console.log(value)
if (value) {
this.setState({ disabled: false })
} else {
this.setState({ disabled: true })
}
}
<ReCAPTCHA
sitekey={captcha_key}
onChange={this.captchaValidate}
className="g_capctha"
/>
我認為問題出在event
上,因為在調用captchaValidate
時事件變得未定義。 我如何在此captchaValidate
中獲取事件,因為將值更改為事件只會給出一些類似於任何標記的文本。 請幫忙。
您可以通過進行基於async
承諾的值獲取來使其工作。
captchaValidate = async (value) => {
this.enterkey();
console.log(value)
if (value) {
this.setState({ disabled: false })
} else {
this.setState({ disabled: true })
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.