Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit b7c8a07

Browse files
authored
Create vuejs-invisible-recaptcha.html
1 parent dd79b80 commit b7c8a07

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

forms/vuejs-invisible-recaptcha.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<title>vue-recaptcha exmaple</title>
7+
</head>
8+
<body>
9+
<h1>This is example to use vue-recaptcha</h1>
10+
<div id="root">
11+
<div>
12+
<h3> Invisible ReCAPTCHA </h3>
13+
<form @submit.prevent="onSubmit" data-netlify-recaptcha data-netlify>
14+
<vue-recaptcha
15+
ref="invisibleRecaptcha"
16+
@verify="onVerify"
17+
@expired="onExpired"
18+
size="invisible"
19+
:sitekey="sitekey">
20+
</vue-recaptcha>
21+
<button type="submit">Submit</button>
22+
</form>
23+
</div>
24+
</div>
25+
<script src="https://unpkg.com/vue@latest/dist/vue.js" defer></script>
26+
<script src="https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer>
27+
</script>
28+
<script src="https://unpkg.com/vue-recaptcha@latest/dist/vue-recaptcha.js"></script>
29+
<script>
30+
new Vue({
31+
el: '#root',
32+
data: {
33+
sitekey: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
34+
},
35+
components: {
36+
'vue-recaptcha': VueRecaptcha
37+
},
38+
methods: {
39+
onSubmit: function () {
40+
this.$refs.invisibleRecaptcha.execute()
41+
},
42+
onVerify: function (response) {
43+
console.log('Verify: ' + response)
44+
},
45+
onExpired: function () {
46+
console.log('Expired')
47+
},
48+
resetRecaptcha () {
49+
this.$refs.recaptcha.reset() // Direct call reset method
50+
}
51+
}
52+
})
53+
</script>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)