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
@@ -21,6 +21,13 @@ I will be super happy if you think this package is good and also star me. ^.^
21
21
22
22
PS: For Vue component, it will be polished in the near future, however, the basic version works fine, feel free to create ticket if you encounter any issues.
Register your action in config, also enable score and set up your own site key and secret key:
272
285
```php
@@ -324,7 +337,127 @@ Create your form in index.blade.php:
324
337
325
338
Go to /index and click submit button on contact us form and you should see an error message that 'Score does not meet the treshhold' because the threshold >2. You can play around the controller to see all outcomes. Importantly, you need to wait the script to be loaded before clicking the submit button.
326
339
327
-
## Advanced Usage
340
+
### Vue Usage <aname="vue-usage" />
341
+
342
+
The package provides a lightweight vue component. You need to publish the vue component before playing around it.
The Blade way is no longer useful if you use Vue, so we need to manage to assign site key by ourselves. The component supports props below:
355
+
356
+
Supported: siteKey, elementId, inline and action, check the original file to see the details.
357
+
358
+
````vue
359
+
<google-re-captcha-v3
360
+
:siteKey="this.siteKey"
361
+
:elementId="'contact_us_id'"
362
+
:inline="true"
363
+
:action="'contact_us'">
364
+
</google-re-captcha-v3>
365
+
366
+
````
367
+
368
+
369
+
There are two ways you can bind reCAPTCHA v3 to the component, in the following example, you need to import GoogleReCaptchaV3 component first and then pass site key into the component.
import GoogleReCaptchaV3 from '../components/googlerecaptchav3/GoogleReCaptchaV3'; // location might be diff to your case, ensure that your location is right
406
+
407
+
export default {
408
+
components: {
409
+
GoogleReCaptchaV3
410
+
},
411
+
data() {
412
+
return {
413
+
siteKey: 'YOUR_SITE_KEY', // provide your site key here
414
+
}
415
+
},
416
+
created() {
417
+
418
+
},
419
+
computed: {},
420
+
mounted() {
421
+
422
+
},
423
+
watch: {},
424
+
methods: {}
425
+
}
426
+
</script>
427
+
428
+
````
429
+
430
+
###### Add site key directly into GoogleReCaptchaV3 component
431
+
432
+
Alternatively, I believe most of cases your site key will never be changed, so you could just modify the original published component to have sitekey hard-coded in.
433
+
434
+
For instance, open published file and find code below:
0 commit comments