bbonch / vue3-recaptcha2 Goto Github PK
View Code? Open in Web Editor NEWVue v3 component for Google reCAPTCHA v2
Vue v3 component for Google reCAPTCHA v2
I'm getting the following error when using the component:
Uncaught (in promise) Error: reCAPTCHA placeholder element must be an element or id
r recaptcha__en.js:313
renderRecaptcha index.js:46
beforeMount index.js:74
recaptcha__en.js:313:258
It seems grecaptcha.render
won't accept this.$refs.recaptcha
as its first parameter.
Hello,
I try to use in codepen.io
But, no success.
I try in two ways.
Whats is wrong? Or work only with node?
Thanks
Job
I observe that for every instantiation of the component, there's a
This is a sample screenshot of this div:
Looking at your code, this element seems to be created by Google's captcha JS. Perhaps there's a call that you need to make to remove this element during component unmount.
Describe the bug
When I load the page in vue v3, I may get an error in the console stating that "window.grecaptcha.render is not a function" and i can't get token from captcha
My Environment
OC: Windows 10
Library: Vue JS v3 with class component
Browser: Chrome, Edge
To Reproduce
Steps to reproduce the behavior:
Expected behavior:
getting token and recaptcha icon showing
Would be nice to add prop language at least
If the window.grecaptcha is not null, the $refs.recaptach in the renderRecaptcha function will not work because we are in the context of "BeforeMount", so the component is not mounted.
You could add a setTimeout in the renderRecaptcha to wait the next frame in this case
Hi, i have an problem with typescript in vue3 composition api for build.
There are types at '/home/serii/Sites/vue/vue-silcompa/node_modules/vue3-recaptcha2/dist_types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue3-recaptcha2' library may need to update its package.json or typings.
I fixed directly in node_modules in vue3-recaptcha2/package.json, replaced this code:
"exports": {
".": {
"import": {
"types": "./dist_types/index.d.ts",
"node": "./index.mjs",
"default": "./dist/vue3-recaptcha2.es.js"
},
"require": "./dist/vue3-recaptcha2.umd.js"
}
},
Can you update the package?
Good job !
However, there is a typo in the props.. You wrote two times "show" so the component is expected a number for the show props
I just follow the example:
<template>
<vue-recaptcha
siteKey="..."
:show="show"
size="normal"
theme="dark"
@verify="recaptchaVerified"
@expire="recaptchaExpired"
@fail="recaptchaFailed"
ref="recaptcha">
</vue-recaptcha>
</template>
<script>
import { defineComponent, ref } from 'vue';
import vueRecaptcha from 'vue3-recaptcha2';
export default defineComponent({
components: {
vueRecaptcha
},
setup(){
const recaptcha = ref('')
return{
recaptcha,
show: ref(false),
recaptchaVerified(response) {},
recaptchaExpired() {
recaptcha.value.reset();
},
recaptchaFailed() {}
}
}
})
</script>
Hey, your package is exactly what I've been searching for! Can you make this available with an Open Source license?
Hi,
Isn't there a way to activate a test mode, so we can use it in our development environment?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.