resources/js/Pages/Contact.vue
<template>//</template> <script>//export default { // beforeMount() { document.getElementById('captchaStyle').innerHTML=""; }, beforeUnmount() { document.getElementById('captchaStyle').innerHTML=".grecaptcha-badge { visibility: hidden !important; }"; }, // methods: { submit() { let submitForm = (token) => { this.fields.captcha_token = token; this.processing = true; this.success = false; this.errors = {}; axios.post('/contact', this.fields).then(response => { this.fields = {}; this.processing = false; this.success = true; }).catch(error => { this.processing = false; if (error.response.status === 422) { this.errors = error.response.data.errors || {}; } }); } grecaptcha .execute('6Ld2bfYdAAAAAL6yv0Oa-lRgw9y93KtIaXDdo20T', { action: "submit" }) .then (function (token) { submitForm(token); }); }, // },}</script>