AurityLab / vue-recaptcha-v3

A simple and easy to use reCAPTCHA (v3 only) library for Vue.
Apache License 2.0
236 stars 25 forks source link

Load on local component instead of global #680

Open rlidev opened 1 year ago

rlidev commented 1 year ago

Does anyone know how to load the library in a single page/component for example (contact page) instead of loading it globally from app.js ?

This is because it unnecessarily loads the library on pages that do not use Recaptcha and it is not very optimal.

yooouuri commented 1 year ago

https://github.com/AurityLab/vue-recaptcha-v3/blob/master/src/ReCaptchaVuePlugin.ts

You need to move the provide to a kind of init function https://github.com/AurityLab/vue-recaptcha-v3/blob/master/src/ReCaptchaVuePlugin.ts#L36-L41

alanscordoba commented 1 year ago

You can use the property autoHideBadge= true, for example:

createApp(App) .use(VueReCaptcha, { siteKey: <key>, loaderOptions: { useRecaptchaNet: true, autoHideBadge: true } }) .mount('#app')