Intégration Svelte
Procaptcha fournit un composant Svelte officiel pour une intégration facile de Prosopo Procaptcha dans n’importe quel projet Svelte. Le composant d’intégration prend en charge toutes les options de rendu Procaptcha.
1. Installation
Titre de la section 1. Installationnpm install @prosopo/svelte-procaptcha-wrapper
2. Exemple d’utilisation
Titre de la section 2. Exemple d’utilisation2.1) Configuration de base
Titre de la section 2.1) Configuration de base<script lang="ts">import {ProcaptchaComponent} from "@prosopo/svelte-procaptcha-wrapper";</script>
<ProcaptchaComponent siteKey={"my-site-key"}/>;2.2) Utilisation avancée
Titre de la section 2.2) Utilisation avancée<script lang="ts">import {ProcaptchaComponent} from "@prosopo/svelte-procaptcha-wrapper";
const siteKey = "my-site-key";const handleVerification = (token: string): void => { console.log('verified', token);};</script>
<ProcaptchaComponent siteKey="{siteKey}"language="en"callback={handleVerification}htmlAttributes={{class: "my-app__procaptcha"}} />