You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div id="contact_us_id"></div> // Your reCAPTCHA div element
403
-
</div>
404
-
405
402
<button type="submit">Submit</button>
406
403
</form>
407
-
<google-re-captcha-v3
408
-
:siteKey="this.siteKey"
409
-
:elementId="'contact_us_id'"
410
-
:inline="true"
411
-
:action="'contact_us'">
412
-
413
-
</google-re-captcha-v3>
414
404
</div>
415
-
416
405
</template>
417
406
<script>
418
-
import GoogleReCaptchaV3 from '../components/googlerecaptchav3/GoogleReCaptchaV3'; // location might be diff to your case, ensure that your location is right
419
-
407
+
import GoogleReCaptchaV3 from '../../components/googlerecaptchav3/GoogleReCaptchaV3';
408
+
// location might be diff to your case, ensure that your component location is right
409
+
420
410
export default {
421
411
components: {
422
412
GoogleReCaptchaV3
423
413
},
424
414
data() {
425
415
return {
426
-
siteKey: 'YOUR_SITE_KEY', // provide your site key here
416
+
form: {
417
+
gRecaptchaResponse: null
418
+
},
419
+
siteKey: 'Your Site Key',
427
420
}
428
421
},
429
-
created() {
430
-
431
-
},
432
-
computed: {},
433
-
mounted() {
434
-
435
-
},
436
-
watch: {},
437
-
methods: {}
422
+
methods: {
423
+
submit() {
424
+
axios.post('/verify', this.form).then(
425
+
response => {
426
+
this.$refs.captcha.execute(); // every time you submit, the reCAPTCHA token needs to be refreshed
427
+
}
428
+
).catch(
429
+
error => {
430
+
this.$refs.captcha.execute(); // every time you submit, the reCAPTCHA token needs to be refreshed
431
+
});
432
+
}
433
+
}
438
434
}
439
435
</script>
440
436
437
+
441
438
````
442
439
443
440
### or Add site key directly into GoogleReCaptchaV3 component
@@ -447,28 +444,15 @@ Alternatively, I believe most of cases your site key will never be changed, so y
447
444
For instance, open published file and find code below:
448
445
````vue
449
446
....
450
-
props: {
451
-
siteKey: {
452
-
type: String,
453
-
required: true
454
-
},
455
-
.....
456
-
},
447
+
siteKey: {
448
+
type: String,
449
+
required: false, // set to true if you don't want to store the siteKey in this component
450
+
default: 'Your Site Key Here' // set siteKey here if you want to store it in this component
0 commit comments