A simple Recaptcha2 Vue component using TypeScript.
Just drop it in your source and it loads everything needed.
You'll need to create a grecaptcha site key:
https://www.google.com/recaptcha/admin
and either place that key in an env config file, e.g.:
$ cat .env.local
VUE_APP_RECAPTCHA_SITE_KEY='12345678'
or pass it as a prop to the component, like:
<recaptcha2 site-key="12345678" @change="robotChange"></recaptcha2>
Note that this does not do any server-side validation of the recaptcha code,
but it does publish a @passed
event with the code, so you can validate it
yourself. Google's Doug Stevenson gives an example on StackOverflow here:
rthutyiutyrtyu