vue-simple-recaptcha

a simple way to integrate google Recaptcha v2 in your vue2 project. Support for both of the invisible and box tick.
2,895
Install
npm install vue-simple-recaptcha
Latest Version:1.0.11
Vue:2
Last Updated:May 20, 2022
Links: npm
Maintainer: hlaingminthan

Vue Simple Recaptcha

a simple way to integrate google Recaptcha v2 in your vue2 project. Support for both of the invisible and box tick.

Installation

add cdn link of google v2 recaptcha api in the head tag of index.html

<script src="https://www.google.com/recaptcha/api.js" async defer></script>

Install vue-simple-recaptcha with npm

npm i vue-simple-recaptcha

App.vue

<template>
  <div id="app">
    <form action="" @submit.prevent="submit">
      <input type="text" />
      <VueSimpleRecaptcha
        sitekey="..."
        ref="recaptcha"
        @callback="callback"
      />
      <button type="submit">Submit</button>
    </form>
  </div>
</template>

<script>
import VueSimpleRecaptcha from "vue-simple-recaptcha";

export default {
  name: "App",
  components: {
    VueSimpleRecaptcha,
  },
  methods: {
    callback(token){
      console.log(token)
      //make ajax request
      console.log('handling ajax request here')
    },
    submit() {
      this.$refs.recaptcha.execute()
    },
  },
};
</script>

Props

invisible - Boolean (default - false)

Version History

Version Released Vue License
1.0.11 ^2.6.14
1.0.10 ^2.6.14
1.0.9 ^2.6.14
1.0.8 ^2.6.14
1.0.7 ^2.6.14