【发布时间】:2021-11-04 19:10:13
【问题描述】:
所以今天我试图验证验证码,但不知何故向我发送了一个错误(我确定我做的一切正常)。
这是我为验证它而编写的代码(我在前端这样做只是为了使用 CAPTCHA 进行教育)
try {
const token = document.querySelector('#g-recaptcha-response').value;
let url = 'https://www.google.com/recaptcha/api/siteverify?secret=mysecretkey&response=token'
fetch( url, {
method: 'POST',
mode: 'no-cors',
})
.then(response => response.json())
.then(data => console.log(data));
} catch (err) {
console.log(err);
}
}
我在控制台中打印了 URL,以便我可以手动访问它并检查一切是否正常(没关系)。
这就是我的contact.vue中的内容
<div class="g-recaptcha" data-sitekey="6LfC0kwcAAAAAMZZA0swdErB5_h8y6R_H7hZ85E7" data-size="normal"></div>
错误:Uncaught (in promise) SyntaxError: Unexpected end of input at eval 即使在 trycatch 中,当我单击错误所在的链接时,它指向我执行 result => result.json() 的行
对此有什么帮助吗?我正在使用 Nuxtjs
【问题讨论】:
标签: vue.js recaptcha recaptcha-v3 grecaptcha