Currently you are viewing v3 document of vue-recaptcha which is still in development

useChallengeV3 v3

Description

A composable to help you execute the reCAPTCHA v3 challenge

Input

  • action: The action for reCAPTCHA v3

Return

export interface UseChallengeV3Return {
  /**
   * reCAPTCHA v3 response as ref
   */
  response: Ref<string | undefined>
  /**
   * Execute the challenge
   * @returns response for reCAPTCHA v3
   */
  execute: () => Promise<string>
}

Usage

<script lang="ts" setup>
import { useChallengeV3 } from 'vue-recaptcha'

const { execute } = useChallengeV3('submit')

async function onSubmit() {
  const response = await execute()

  // do something with response
  console.log(response)
}
</script>

<template>
  <div>
    <button @click="onSubmit">
      submit
    </button>
  </div>
</template>