我想要在組件中使用vue js進行recaptcha回調。驗證碼本身確實有效,但不是我在data-callback
屬性中定義的回調。Vue js google reCaptcha回調
我試過了所有我能想到的,但我仍然得到ReCAPTCHA couldn't find user-provided function: dothisthat
錯誤。
這裏是組分
<script>
function dothisthat(){
alert(312);
}
</script>
<template>
<div class="well main-well">
<h4>Captcha</h4>
<p class="small">You must complete the captcha to finish your booking.</p>
<div id="captcha-wrapper">
<div class="g-recaptcha" :data-sitekey="captchaKey" data-callback="dothisthat"></div>
</div>
</div>
</template>
<script>
function dothisthat(){
alert(123);
}
import * as filters from '../../../filters';
import Translation from '../../../Translation';
export default {
name: 'Captcha',
props: {
},
computed: {
captchaKey: function() {
return this.$store.getters.captcha;
}
},
methods: {
dothisthat: function(){
return function() {
console.log("123");
};
}
},
mounted(){
function dothisthat() {
alert(123);
}
$(function() {
function dothisthat() {
alert(123);
}
});
}
}
</script>
不的dothisthat
功能之一是獲取調用。 我在做什麼錯?
嘗試':數據回調= 「dothisthat」'? – thanksd
回來了,ReCAPTCHA找不到用戶提供的函數:function boundFn(a){varl = arguments.length; return l ? l> 1 ? fn.apply(ctx,arguments) :fn.call(ctx,a) :fn.call(ctx) } – user2209644